I have a Windows 10 Universal App that does not include line numbers in the Exception objects .ToString() method.
If I have a method like
private void ThrowException()
{
try { throw new Exception("Test"); }
catch (Exception e) { Debug.WriteLine(ex.ToString()); }
}
When I check the output, I don't see the line number where there exception was thrown. I added a Post Build event to the project:
xcopy $(ProjectDir)$(OutDir)*.pdb $(ProjectDir)$(OutDir)AppX\*.pdb
The pdb file is in the Debug folder but not in the AppX folder.
What am I missing? Thanx,
EDIT
I created a new project to test this. I have a single page (MainPage.xaml). Here is the code behind file:
using System;
using Windows.UI.Popups;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
namespace App2
{
public sealed partial class MainPage : Page
{
public MainPage()
{
InitializeComponent();
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
ThrowException();
}
private async void ThrowException()
{
try { throw new Exception("Test"); }
catch (Exception ex) { await new MessageDialog(ex.ToString()).ShowAsync(); }
}
}
}
As before, I added the post build event macro:
xcopy $(ProjectDir)$(OutDir)*.pdb $(ProjectDir)$(OutDir)AppX\*.pdb
I compiled in the Release configuration and insured the "Compile with .NET native tool chain" option is checked.
The Appx folder in C:\VS2015\App2\App2\bin\x86\Release\AppX does have the files App2.dll and App2.pdb present.
When I run the app, I get the following in the popup dialog:
System.Exception: Test
at SharedLibrary!<BaseAddress>+0x122d16
Thanx
EDIT 2
I also tried this in Debug without the native tool chain. In that case, I did not see the pdb file in the AppX folder under Debug
The message in that case was:
System.Exception: Test
at App2.MainPage.<ThrowException>d_2.MoveNext()
Thanx