Debug XBAP hosted in WPF Application

2019-06-10 16:30发布

问题:

I have a WPF Application (say, WPF.exe) with multiple tabs. In one of the tabs, I display a *.xbap using: WebBrowser tag.

<WebBrowser Source="c:/PublishedWebSites/Test.xbap"/>

When I start WPF.exe, I am able to attach debugger to any other UserControl but not to my XBAP. I also tried attaching my XBAP to PresentationHost.exe process which was started when I click on the browser tab.

The break points are not hit in XBAP project, though I verified that when I publish the XBAP, I oublish *.pdb files as well.

Could anyone tell me what I am doing wrong here?

Thanks, RDV.

回答1:

I could debug. Steps: 1. Compile and Publish XBAP. DO NOT change anything after publishing.. in case you do.. republish it. 2. Ensure there are no PresentationHost.exe processes running. 3. Run the WPF application. Launch XBAP (as one of the tabs ..in my case). 4. Debug->Attach to process-> Connect to PresentationHost.exe=> ensure that you select the correct 32 vs 64 version (i think this was my mistake).

Thanks, RDV