Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I debug a published XBAP file in VS2010?

Tags:

c#

debugging

xbap

I need to debug a full-trust application either by specifying a URL or, ideally, from within the web app I am intending to deploy it to. I've tried the following:

  • Running "PresentationHost.exe -embedding" from the command-line, attaching through Visual Studio. The IDE shows that my breakpoints are valid until I actually attempt to load the .xbap file, at which point it shows that there are no symbols loaded. None of my breakpoints are hit. I've tried "mage -cc" before doing this per several recommendations elsewhere.

  • Hard-coded URL in the project's Debug panel then F5. Alternatively, "PresentationHost.exe -embedding -debug" and attach to process then load the .xbap in IE. Both result in the following error when the page appears:

System.ArgumentException: URI formats are not supported.

   at System.IO.Path.NormalizePath(...)
   at System.IO.FileStream.Init(...)
   at System.IO.FileStream..ctor(...)
   at System.Windows.Interop.ApplicationLauncherXappDebug.GetIdFromManifest(...)
   at System.Windows.Interop.ApplicationLauncherXappDebug.GetApplicationIdentity()
   at System.Windows.Interop.ApplicationLauncherXappDebug.Initialize()
   at System.Windows.Interop.DocObjHost.MS.Internal.AppModel.IBrowserHostServices.Run(...)
like image 781
flatline Avatar asked Sep 10 '10 21:09

flatline


1 Answers

Found it. The "PresentationHost.exe -embedding" will work, provided that you select the .pdb file to be published, which it is not by default. This follows from what I saw before, where the debugger appeared to have symbols then not, once the app actually loaded. To clarify:

  • Go into the Publish tab on the project properties
  • Click "Application Files..."
  • Check "Show all files"
  • Select the .pdb file for the executable to be included.
  • Republish
  • PresentationHost.exe -embedding
  • Attach to process or set the project to run this out of the debug tab
  • Launch the web page in a browser and navigate to the xbap file, breakpoints should be hit now.
like image 179
flatline Avatar answered Oct 01 '22 03:10

flatline