Description
The repro is here: https://github.com/evgrud/dotnet-stack-trace-offsets-issue
When running it on Release (with tiered compilation disabled) you will see that the stack trace of the exception that is thrown points to the beginning of the function while the correct location is at its end.
I tested it on Windows 10 x64.
I ran it with JITDump and it seems that during impImportCall
some of the statements aren't getting IL offsets which later during the inlining are expanded into new basic blocks without IL offsets, which eventually during runtime results in a bad stack trace when an exception is thrown within those basic blocks.
I don't know if this issue should be fixed, but I can suggest reporting native offsets in those cases instead of pointing to the top of the function which could be way off.
category:implementation
theme:debug-info
skill-level:intermediate
cost:small