Answered by:
How to debug protocol activation

Question
-
How to debug application launch from protocol activation?
I am seeing that when app is running, protocol activation is working fine. But when app is not running, and launched by protocol activation, something goes wrong, and app does not behave as expected.
How to debug protocol activation in this case?
Traditionally, we do by putting Thread.Sleep and AttachToProcess, but Thread.Sleep (and other alternative is not there)/
mole on left eye
Tuesday, July 24, 2012 5:56 AM
Answers
-
You can try Task.Delay(int milliseconds) but I think if the application is running on debug and you activate it from a link the break points would be hit (this works for background tasks)
Can Bilgin
Blog CompuSight- Proposed as answer by Vicky SongMicrosoft employee, Moderator Monday, July 30, 2012 8:05 AM
- Marked as answer by Vicky SongMicrosoft employee, Moderator Thursday, August 2, 2012 6:53 AM
Tuesday, July 24, 2012 6:36 AM -
I see... You should give it a shot with:
// 2 seconds blocking delay in the execution await Task.Delay(2000);
here is the msdn details: http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh194873%28v=vs.110%29.aspxCan Bilgin
Blog CompuSight- Proposed as answer by Vicky SongMicrosoft employee, Moderator Monday, July 30, 2012 8:05 AM
- Marked as answer by Vicky SongMicrosoft employee, Moderator Thursday, August 2, 2012 6:53 AM
Wednesday, July 25, 2012 9:13 AM
All replies
-
You can try Task.Delay(int milliseconds) but I think if the application is running on debug and you activate it from a link the break points would be hit (this works for background tasks)
Can Bilgin
Blog CompuSight- Proposed as answer by Vicky SongMicrosoft employee, Moderator Monday, July 30, 2012 8:05 AM
- Marked as answer by Vicky SongMicrosoft employee, Moderator Thursday, August 2, 2012 6:53 AM
Tuesday, July 24, 2012 6:36 AM -
I will figure out Task.Delay. The scenario is that app is not already running, but launched from Activation. It will require AttachToProcess first. This is where breakpoint is lost (by the time i attach the process, the logic where breakpoint is located is already hit)
mole on left eye
Tuesday, July 24, 2012 9:29 AM -
I see... You should give it a shot with:
// 2 seconds blocking delay in the execution await Task.Delay(2000);
here is the msdn details: http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh194873%28v=vs.110%29.aspxCan Bilgin
Blog CompuSight- Proposed as answer by Vicky SongMicrosoft employee, Moderator Monday, July 30, 2012 8:05 AM
- Marked as answer by Vicky SongMicrosoft employee, Moderator Thursday, August 2, 2012 6:53 AM
Wednesday, July 25, 2012 9:13 AM -
any luck?
Can Bilgin
Blog CompuSightFriday, July 27, 2012 6:12 AM -
Hi All,
I believe adding delay and then manually attaching debugger is a kind of a workaround.
Here's how I did it :
Once the app is deployed, In VS -> Debug Menu -> Debug Installed App packages
Select you Windows store app (You should deploy the app before this step) and then select start. Now once the app is launched through protocol activation, the debugger should kick in automatically.
Hope this helps!
- Edited by Vinayak_Bhosale Tuesday, July 16, 2013 9:45 PM typo
Tuesday, July 16, 2013 9:44 PM