-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ExecutionEngineException when using step-by-step #63199
Comments
Tagging subscribers to this area: @tommcdon Issue DetailsDescriptionWhen trying to find the source of an "CancelledOperationException" being thrown in background in my app, I stumbled on a weird bug. Reproduction StepsClone my repo Kuinox/CK-LogViewer@ac8a945 and checkout on the commit linked (it was the develop branch when this issue was opened). Run
Expected behaviorBeing able to debug my program. Actual behaviorAn ExecutionEngineException is throwed. Regression?I don't know, new app/code. Known WorkaroundsNo response Configuration.NET 6.0.1 Windows 11/10 Other informationNo response
|
Tell me if you successfully reproduced it or if you want that I make a more minimal reproduction. |
HI @Kuinox I'm not able to reproduce the issue. Under Debug->Options, I have Just My Code disabled and Suppress JIT optimization on module load enabled. Without those settings I was not able to step into the |
@Kuinox I hit send too soon above. To collect a dump, please choose Debug->Save Dump As in VS. |
I created a dump using dotnet-dump cli tool and made a ticket on VS Feedback, sadly it looks like the ticket & dump file is public and I can't find a way to make it not public :/ |
@Kuinox I've sent out an urgent request internally to try to get it deleted. I'm not sure why it's public -- if I remember a correctly there's a checkbox that makes it public. |
Thanks ! I don't think there is anything important as it's not my work machine, but it's better be safe. I was not sure it would be public, and didn't found any checkbox to make it public or private, in fact there is even a "secured" (what does it mean ?) indicator next to the form: |
Thanks @danmoseley! @Kuinox I've downloaded the dump so it's safe to delete the uploaded files. |
Ok, I edited the ticket to remove the link to the uploaded dump. |
@Kuinox Thanks again for the dump. This issue will require more investigation. Here's my rough notes so far. It looks like the debugger hit a breakpoint and it working to determine where the stub leads to, and in that process it hit an Access Violation (AV). AV's in the runtime are translated to ExecutionEngineException's. Is this failing deterministically for you? For us to understand this better we can provide you with an instrumented runtime that will provide better logging which should help us understand the root cause better.
|
Yes more or less, when VS doesn't simply freeze while stepping into this code, it reproduce the exception everytime. |
Yes, what should I do ? |
@Kuinox This item is on our backlog but we don't have time right now to work on this. In the meantime, please try working around the issue by manually setting breakpoints on target methods. instead of stepping into the method causes the app/VS to freeze. |
Ok ok, thanks for the update. |
@davidwrighton @AaronRobinsonMSFT @jkoritzinsky - this bug appears to be a long-standing issue with IL stubs, I'm not sure who the owner of that is these days? The short version is that ILStubManager::TraceManager doesn't appear to correctly handle all the ILStubs that the runtime creates. A few years ago we encountered a very similar problem with a different type of ILStub that this method didn't handle so this appears to be a repeating problem. Investigating the dump that @Kuinox sent us, this is the long version of what I think likely has happened:
That call at the end will lead to executing the jitted code for the IL instantiating stub for SendPacketAsync(...)
I'm pretty sure the bug is right here in the incorrect classification, but execution continues a little further doing calculations based on garbage data...
The AV occurs at
|
Duplicate of #38777 ? The proposed fix: #38777 (comment) |
/cc @dotnet/interop-contrib |
Ah thanks! I had some recollection talking about this issue before, but I missed #38777 and found only #36248. My take is that each of these issues represents a distinct type of ILStub so they aren't quite duplicates, but a common solution that would cover all of them would be to ensure that StubManager::TraceManager handles all ILStub types produced by the runtime. |
Here is a simplified repro case:
IClient client = new Client();
client.SendPacketAsync<object>(1, 2, 3, 4);
client.PublishAsync();
static class Extensions
{
public static void PublishAsync( this IClient client)
{
client.SendPacketAsync<object>(1,2,3,4); // <----- set breakpoint here
}
}
interface IClient
{
public void SendPacketAsync<T>(int arg1, int arg2, int arg3, int arg4);
}
class Client : IClient
{
public void SendPacketAsync<T>(int arg1, int arg2, int arg3, int arg4)
{
Console.WriteLine(typeof(T).Name);
}
}
Expected result: execution pauses inside SendPacketAsync() |
Thanks ! |
Description
When trying to find the source of an "CancelledOperationException" being thrown in background in my app, I stumbled on a weird bug.
When I step in a specific place, it will throw a
ExecutionEngineException
, and if I try to continue the program execution it will freeze VS2022 (and I must kill it with taskmanager).As I don't know where the issue come from, I created the issue here.
Reproduction Steps
Clone my repo Kuinox/CK-LogViewer@ac8a945 and checkout on the commit linked (it was the develop branch when this issue was opened).
Run
LogSampleGenerator
until it hit theDebugger.Break()
.Now due to this issue: dotnet/sdk#1458, 3 pdb must be loaded by hand in VS, they are located in the nuget cache:
%userprofile%\.nuget\packages\ck.mqtt.abstractions\0.10.0\lib\net6.0
%userprofile%\.nuget\packages\ck.mqtt.common\0.10.0\lib\net6.0
%userprofile%\.nuget\packages\ck.mqtt.client\0.10.0\lib\net6.0
Now navigate to
Now trying to step in
SendPacketAsync
throw theExecutionEngineException
.Pressing F5/F10 here lead to VS freezing.
Expected behavior
Being able to debug my program.
Actual behavior
An ExecutionEngineException is throwed.
Regression?
I don't know, new app/code.
Known Workarounds
No response
Configuration
.NET 6.0.1 Windows 11/10
Other information
No response
The text was updated successfully, but these errors were encountered: