Runtime: Exception stack trace does not have line numbers

Created on 16 May 2017  路  13Comments  路  Source: dotnet/runtime

Repro:

  • dotnet new console
  • Update the Program.cs file to
    ```c#
    using System;

namespace bar2
{
class Program
{
static void Main(string[] args)
{
try
{
throw new InvalidOperationException("some error");
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
}
}
}

- dotnet run
- The above code would print out like the following (Notice that there is no line number information)

System.InvalidOperationException: some error
at bar2.Program.Main(String[] args)

**dotnet --info**

.NET Command Line Tools (2.0.0-preview2-006071)

Product Information:
Version: 2.0.0-preview2-006071
Commit SHA-1 hash: 8326a60d7a

Runtime Environment:
OS Name: Windows
OS Version: 10.0.15063
OS Platform: Windows
RID: win10-x64
Base Path: C:\Userskichalla.dotnet\x64\sdk\2.0.0-preview2-006071\

Microsoft .NET Core Shared Framework Host

Version : 2.0.0-preview2-25309-07
Build : 41f5fc94eedc889f086800c23f35bf14a8c75a9f
```

area-System.Diagnostics

Most helpful comment

Just as an fyi, we did get portable pdb support added to the version of desktop .Net Framework in development now (I think that will be version 4.7.1 when it releases).

All 13 comments

Weird, it works fine for me on 2.0.0-preview1-005977, but I get the same behavior as you on 2.0.0-preview2-006080. I wonder what changed.

cc: @mikem8361

This has been fixed. The fix has made it into preview1 Microsoft.NETCore.App (2.0.0-preview1-002111-00) and preview2 Microsoft.NETCore.App (2.0.0-preview2-25316-09).

@mikem8361 do you know how to correlate 2.0.0-preview2-006082 (the latest version on https://github.com/dotnet/cli) with 2.0.0-preview2-25316-09 (the number you cite - I guess the version off core-setup)?

These versions are for the Microsoft.NETCore.App nuget package which is part/installed by dotnet cli. It this case, dotnet cli version 6082 doesn't have either of the above versions. I have no idea when dotnet cli will.

@gkhanna79 can you help clarify?

Which corefx build had the fix? @eerhardt can then tell which cli may have the change.

The latest runtime build that the CLI is on is 2.0.0-preview2-25309-07 (See https://github.com/dotnet/cli/blob/master/build/DependencyVersions.props#L4) which is earlier than when the fix came in 2.0.0-preview2-25316-09.

We have been doing a bunch of engineering work in dotnet/core-setup which is slowing the frequency of runtime builds flowing into the CLI.

This is fixed and should be in preview2.

This is broken again for net461 targeting desktop applications.

Same repro as in this issue with the following csproj:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net461</TargetFramework>
  </PropertyGroup>

</Project>

Output:

System.InvalidOperationException: some error
   at temp.Program.Main(String[] args)

Note the lack of filename/line number.


Dotnet info:

~\Documents\GitHub\temp> dotnet --info
.NET Command Line Tools (2.0.0-preview2-006215)

Product Information:
 Version:            2.0.0-preview2-006215
 Commit SHA-1 hash:  e67962b0de

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.15063
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Users\nimullen\.dotnet\x64\sdk\2.0.0-preview2-006215\

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.0-preview2-25401-01
  Build    : ed803065c52b020c50f9deaed533f7474982969f

I've been informed that net461 may not support the reading of portable pdbs. Is this expected then?

Yes, net461 doesn鈥檛 have portable pdb support. We are currently working on. This issue was for only .NET Core.

/cc:@noahfalk

Ok good to know. We'll work around it on our end 馃憤

Just as an fyi, we did get portable pdb support added to the version of desktop .Net Framework in development now (I think that will be version 4.7.1 when it releases).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

iCodeWebApps picture iCodeWebApps  路  3Comments

omariom picture omariom  路  3Comments

nalywa picture nalywa  路  3Comments

bencz picture bencz  路  3Comments

btecu picture btecu  路  3Comments