I have developed an UWP app that uses a lot of NuGet packages (MvvmLight, SQLite, ...) and other resources (Syncfusion controls).
I encounter a bug with the Store app, which is already published for tests, that is not present when I build the app in "Debug" mode.
So, I've tried to debug in "Release" mode, with the checked options "Compile with .NET Native tool chain" and "Optimize code". The build ends successfully, but I encounter an exception with a Syncfusion control (SfDataGrid) on the main page of the app. I would like use breakpoints to understand what happens, but they are deactivated as I build the app in "Release" mode.
If I build the app in "Debug" mode, with the same options checked ("Compile with .NET Native tool chain" and "Optimize code"), I don't encounter the same bug with the Syncfusion control, and the defined breakpoints are well keeped.
So I don't see how I could fix my problem:
- if I create a new solution and built it in "Release" mode, the breakpoints are well keeped, and I can debug the code
- if I build Syncfusion samples in "Release" mode, it's the same thing: the breakpoints are well keeped, and I can debug the code
- I have compared the "build" parameters of the app and the other ones: they are the same
- I have also looked at the "Just-in-Time" page, in the Visual Studio "options". I've got the following error: "Another debugger has registered itself as the Just-In-Time debugger. To repair, enable Just-In-Time debugging or run Visual Studio repair.". Ive tried to "repair" Visual Studio, but it's always the same thing...
Here is the "Options" settings: enter image description here
And the result in solution, where breakpoints are disabled: enter image description here
Would you have any explanation? How could I do to debug my app in "Release" mode?
[Edit 1]: add some details after further investigations
My app is based on a "template" like Template10, called Nentang. The structure of the project is the same, and they share a big part of references or NuGets packages. But if I compare the build result of the "blank" Nentang and my solution, there are some differences that I don't understand:
- as explained, on my app, the breakpoints and debug don't work in "Release" mode, and I can see that almost all modules don't have any "Symbol File":
=> only "ntdll.dll" and "KernelBase.dll" are linked to thier pdb file in a local directory: "C:\Users\myname\AppData\Local\Temp\SymbolCache"
- on the "blank" Nentang app, the breakpoints and debug work well in "Release" mode, and I can see that almost all modules have a "Symbol File":
=> allmost half of the modules are linked to the same file in the "project" directory: "C:\Projects\Samples...\Nentang.UWP\bin\x64\Release\AppX\Nentang.UWP.pdb"
=> another quarter of the modules are linked to the same file of a "system" directory: "C:\Program Files (x86)\Microsoft SDKs\Windows Kits10円\ExtensionSDKs\Microsoft.NET.Native.Framework.1.31円.3\x64\ret\Native\SharedLibrary.pdb"
=> the other modules are not linked to a Symbol File: it's the case of "ntdll.dll" and "KernelBase.dll"
How could I restore the "Symbol files" of my project?
I have also remarked a "strange" parameter in the properties of my solution, that is not present is the Nentang properties: SolutionProperties There is this parameter: "f:\dd\ndp\fxcore\CoreRT\src\System.Private.CoreLib\src\System\Runtime\ExceptionServices\ExceptionDispatchInfo.cs"
What does it mean? Could it explain my problem?
-
1When you hover over the disabled breakpoint, the IDE will show a tooltip with additional information. I'm guessing that you aren't generating debug information (PDB files). PDB's are required to map source code locations to addresses in the binary.IInspectable– IInspectable2017年02月15日 18:53:38 +00:00Commented Feb 15, 2017 at 18:53
-
Thanks for your feedback @IInspectable. The error is "The breakpoint will not currently be hit. No symbols have been loaded for this document.". But how is this possible, knowing that the build parameters are the same in the different projects?Gold.strike– Gold.strike2017年02月15日 19:26:12 +00:00Commented Feb 15, 2017 at 19:26
-
1If debug symbols aren't loaded, then they are either in a place where the debugger doesn't look for them, or they do not exist. Release configurations often times do not build debug information. See Specify Symbol (.pdb) and Source Files in the Visual Studio Debugger for more information.IInspectable– IInspectable2017年02月15日 19:52:41 +00:00Commented Feb 15, 2017 at 19:52
-
I've tried to clean the solution, and to remove bin/object folders of each project, but the problem is always the same. I will take a look to your link, to see if it helps me to understand the problem.Gold.strike– Gold.strike2017年02月15日 19:56:07 +00:00Commented Feb 15, 2017 at 19:56
-
@IInspectable I wasn't able to fix my problem, but I've added some details about "Modules" in the main description. Could this help you to give me a response?Gold.strike– Gold.strike2017年02月16日 00:31:00 +00:00Commented Feb 16, 2017 at 0:31
1 Answer 1
Debugging optimized code is always a challenge - even more so with .NETNative. Here are a few things you could try:
- Disable Just My Code
- Suppress JIT Optimizations: This will not help for modules built with .NETNative toolchain. If the exception occurs in Release builds without .NETNative, then check the debugger option called "Suppress JIT optimization on module load (Managed Only)". As the name implies, this will cause the CLR to JIT compile code unoptimized, which will allow you to set breakpoints and inspect locals.
- Look at the Output window for clues as to what went wrong. The exception message will be there and the preceding messages may help diagnose the cause.
- Debug your application with Native debug engine. You can do this by checking the Native checkbox under the Debug tab of the project properties.
- Last resort is to debug the assembly.
3 Comments
Just my code is already disabled. I've already debug in Debug mode with Native toolchain and there is not the same problem that is encountered on the Store app: this is not helpfull for me. In Release the Output windows doesn't really give more details about my problem: Loaded 'C:\Windows\SysWOW64\globinputhost.dll'. Skipped loading symbols. Module is native, and native debugging is currently disabled. Unhandled exception at 0x103773C8 (Windows.UI.Xaml.dll)Release mode if the .NET Native toolchain is unchecked: in these case, the breakpoints are also available. So it's not usefull to suppress the JIT Optimizations isn't it?Explore related questions
See similar questions with these tags.