runtime: EnC: ExecutionEngineException after edit in struct returning method
Version:
CoreCLR 3.1 and Desktop CLR 4.7.1
Steps to Reproduce:
namespace DebuggerTest
{
public class GenericStructReturn
{
public static void Main() { System.Console.WriteLine(F()); }
public static S<object, object> F()
{
return new S<object, object>("Hello", ""); // Breakpoint on this line
}
}
public struct S<T1, T2>
{
private T1 o1;
private T2 o2;
public S(T1 o1, T2 o2)
{
this.o1 = o1;
this.o2 = o2;
}
public override string ToString()
{
return o1 + " " + o2;
}
}
}
- In the code above, place a breakpoint inside the F() method
- F5
- When the breakpoint is hit, put a string in for the second constructor parameter
- F5
- Observe the crash
Looked into it from the Roslyn side and seems to be a CLR bug.
From feedback ticket https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1246874 /cc @tmat
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 26 (23 by maintainers)
Having looked at this issue on the back of a StackOverflow question, it appears to result from
varNumber
not being treated as a signed value when indexing intooldMethodVarsSorted
/newMethodVarsSorted
.As a result, for special vars with negative
varNumber
s, instead of placing them in the space reserved at the beginning of the correspondingoldMethodVarsSortedBase
/newMethodVarsSortedBase
arrays for special vars, it is treated as a large positive index way off the end of the array.Hope this helps.
I expect there will be others. 😉
cc: @danroth27, @LyalinDotCom
I don’t understand why the fact that it reproes on desktop has any impact on scheduling of the fix. We are spending a lot of effort on improving EnC/Hot Reload experience for .NET 6. This issue is relevant to this effort.
The method being modified is not generic. This should be supported.