-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
StackTrace/StackFrame don't have a file name or position in .NET Core on Windows, but do with .NET Core on Unix and .NET Framework #22302
Comments
That's weird. @joperezr is it on purpose? |
This seems like a recent regression. I actually noticed it before writing tests in dotnet/corefx#21040 (they fail on Unix because of this bug), because the stack trace test failures no longer have line numbers or file info in them with .NET Core. This made it super hard to track down failures. But when I changed to .NET Framework, I had line numbers I thought it was just a tooling thing, but looks like a bug, and a pretty bad one at that. |
That looks suspicious, @joperezr can you please take a look for 2.0 into it? (or route it ASAP) Thanks! |
This issue gets even weirder. I only occurs in Debug mode on Windows, not Release |
cc: @mikem8361 |
If the only scenario that this occurs is on Windows Debug, then I'm moving it to 2.1. |
@mikem8361 could you also confirm that this isn't the cause of the following difference between netfx and netcoreapp (on Windows) Code: [Fact]
public void InvokeMethodThatThrowsException()
{
ThrowExceptionPlease();
}
public void ThrowExceptionPlease()
{
throw new Exception();
} Netfx:
Netcoreapp:
I can also repro this example above in Release mode, so I'm not sure if it's related, as the tests seemed to fail in Windows Release in the dotnet/corefx#21040. Note that netcoreapp has no line numbers and no no file name so this makes things hard to action on. I thought it was just a tooling thing but what do I know |
What version of the .NET Core Windows runtime were you using? Did you generate portable PDBs or Windows PDBs for your test app? If you are using Windows PDBs, make sure that microsoft.diasymreader.native.amd64.dll is in your shared framework binaries ("\Program Files\dotnet\shared\Microsoft.NETCore.App<version>"). If your app is built with Portable PDBs, there was a bug in System.Diagnostics.StackTrace that should be fixed now. |
I'm running from master in the test projects for master |
(As in, these are contributions to corefx, not my own app) |
Sorry to keep flogging a dead horse, but I'm not sure why the following has different behaviour in .NET Core vs .NET Framework.
[Fact]
public void THROW()
{
throw new InvalidOperationException();
}
Notice that there are no line numbers or file paths for netcoreapp. If this is a bug in netcoreapp or even in the tooling for corefx, then isn't this really bad? In more advanced examples than the one I added, we can't diagnose where a test failure happened! |
The source/line number info on .NET Core is missing because microsoft.diasymreader.native.amd64.dll doesn't exist in the bin directory. It is from the Microsoft.DiaSymReader.Native package which is part of the shared framework, but doesn't seem to be part of the corefx runtime binaries. It is used by the coreclr runtime to load Windows PDBs. Now if the tests used portable PDBs that would work on (.NET Core only). |
And that is also reason there are source/line numbers on the Linux runs (because they can only use portable PDBs). |
@weshaggard can we fix this? (or change to portable pdb's on windows) |
If I manually copy @weshaggard what is the correct way of fixing this? for now I'm pasting this line into tests.targets, which only works for uap. |
The right way to fix it is to reference the |
Let's leave this open while we see whether it fixes the problem. |
Yes what @mellinoe says is the correct way to fix this. |
@weshaggard we have line numbers for netcoreapp now but this doesn't appear to work for UAP nor ILC Can you help with that? I assume ILC is a harder problem. |
Fixed with PR dotnet/coreclr#14696 |
The following example is a test that passes with netfx, passes with netcoreapp on Unix, but not with netcoreapp on Windows.
The text was updated successfully, but these errors were encountered: