El siguiente código proporciona resultados diferentes cuando ejecuta la versión dentro de Visual Studio y ejecuta la versión fuera de Visual Studio. Estoy usando Visual Studio 2008 y estoy apuntando a .NET 3.5. También probé .NET 3.5 SP1..NET JIT ¿error potencial?
Cuando se ejecuta fuera de Visual Studio, el JIT debería activarse. O bien (a) hay algo sutil sucediendo con C# que me falta o (b) el JIT está realmente en error. Estoy dudoso que el JIT puede salir mal, pero me estoy quedando sin otras posibilidades ...
de salida cuando se ejecuta dentro de Visual Studio:
0 0,
0 1,
1 0,
1 1,
de salida cuando se ejecuta la liberación fuera de Visual Studio:
0 2,
0 2,
1 2,
1 2,
¿Cuál es el motivo?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Test
{
struct IntVec
{
public int x;
public int y;
}
interface IDoSomething
{
void Do(IntVec o);
}
class DoSomething : IDoSomething
{
public void Do(IntVec o)
{
Console.WriteLine(o.x.ToString() + " " + o.y.ToString()+",");
}
}
class Program
{
static void Test(IDoSomething oDoesSomething)
{
IntVec oVec = new IntVec();
for (oVec.x = 0; oVec.x < 2; oVec.x++)
{
for (oVec.y = 0; oVec.y < 2; oVec.y++)
{
oDoesSomething.Do(oVec);
}
}
}
static void Main(string[] args)
{
Test(new DoSomething());
Console.ReadLine();
}
}
}
+1 - qué gran problema es éste :) –
Sí, qué tal eso: encontrar un error grave en algo tan esencial como el .NET JIT - ¡felicitaciones! –
Esto parece reproducirse en mi versión del 9 de diciembre del framework 4.0 en x86. Lo pasaré al equipo de jitter. ¡Gracias! –