سؤال

I'm developing an app for WP8 using VS 2012 Express for WP. I write the debug messages to the debug log using System.Diagnostics.Debug.WriteLine(string message); method as specified in the docs.
The debug log works fine as long as the application is run on the emulator; all the debug messages appear in the log. But when I deploy the application on the device (developer unlocked), the application runs but the debug log is completely empty.
How do I get the messages to appear on the log for the device too?

EDIT: The application is deployed in Debug mode, but it appears no debug information is shared between the device and the IDE; all breakpoints are ignored, the debug buttons remain disabled and the log remains empty. The only buttons that work are Stop Debugging and Restart. I can only see the Build notes, which are as follows.

1>  Xap packaging completed successfully
2>------ Deploy started: Project: Scanner, Configuration: Debug Any CPU ------
2>Deploying E:\WP8 Apps\Scanner\Scanner\Bin\Debug\Scanner_Debug_AnyCPU.xap...
2>Connecting to Device...
2>Optimizing for device...
2>The application is already installed on the device. Checking if an incremental deployment is possible...
2>Doing incremental deployment...
2>Updating information related to modified files...
2>Deployment of E:\WP8 Apps\Scanner\Scanner\Bin\Debug\Scanner_Debug_AnyCPU.xap succeeded.
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Deploy: 1 succeeded, 0 failed, 0 skipped ==========

I was able to get these messages from the Debug console after some tweaking:

'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\System.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\System.Xml.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\Data\Programs\{FD42B1AC-461D-49C8-96FA-D529947ED936}\Install\Scanner.DLL'. Cannot find or open the PDB file.
هل كانت مفيدة؟

المحلول 2

I figured it out. Seems like something was wrong with the IDE or perhaps the solution itself. Removed the solution to create a fresh one, and debugger runs just fine!

نصائح أخرى

  1. Make sure you deployed to the device in "Debug" mode, not "Release" mode.
  2. Check the "Output" tab in Visual Studio when you're debugging the application. If you know how to set Breakpoints in your code, set one right where you write to the log, and step over it. See if the Output window has written your message.
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top