MrAdvice: Release assembly with weaved Task function crashes
Hi, another interesting bird. I add the complete, as simple as possible, project emulating bug. When you start it from VS in Debug mode - works, when you start exe from DEBUG folder - works. When you start it from VS in Release mode or exe from from RELEASE folder - crashes. with Critical error (the same as in previous bug).
Both not working neither async function calling async Task nor sync calling async
//Fatal error
public void StartTask()
{
var task = System.Threading.Tasks.Task.Run(async () => await AddWhatever());
var r = task.Result;
}
//Fatal error
public async void StartTask1()
{
long r = await AddWhatever();
}
public async System.Threading.Tasks.Task<long> AddWhatever()
{
return -1;
}
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 42 (16 by maintainers)
The
PdbAsyncMethod
instance is in:body.PdbMethod.AsyncMethod
In that case, you need to update all
PdbAsyncMethod.StepInfos
. TheBreakpointMethod
field must be updated to the new method.Works in the latest version!
I think the journey not finished yet, it compiles, but this function that contains Task.Run(async () => await _M._Users.AddUser fails to be run in RELEASE MODE
here is the ILDump
I’m sorry, this is (again) a logging problem, which I’m going to fix once for all in a dependency project. Until there, it should be fixed in 2.5.16.