The following code throws an ExecutionEngineException when launching the release build executable (running the exe file ). Is this a mistake or is this normal behavior?
value type with batch size = 1:
[StructLayout(LayoutKind.Sequential, Pack = 1)] public struct RunLong { public byte Count; public long Value; public RunLong(byte count, long value) { Count = count; Value = value; } }
Using the structure in the general list (T), adding values ββand getting or setting its value leads to the failure of the executable file if it was created in the release mode. A crash does not occur when the executable is embedded in debug mode or when running code inside the visual studio debugger (debug or debug mode).
List<RunLong> runs = new List<RunLong>(1024); for (int i = 0; i < 1000; i++) { runs.Add(new RunLong(1, i)); } RunLong last = runs[runs.Count - 1]; last.Count = (byte)(last.Count + 1); runs[runs.Count - 1] = last;
Can anyone confirm this? Is there a reasonable explanation?
I am running VS 2010, .net 4, Win XP SP3
Thanks in advance!
user410903
source share