且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

[UWP]在Universal应用程序中调试Web应用程序

更新时间:2022-10-21 10:32:38

Hello Magnus,


你看过这个论坛的帖子吗?


https://social.msdn.microsoft.com/Forums/en-US/250e8e87-8eff-4af3-b957-2cf12d7ee89c/can-you-disable-the-disablexamlgeneratedbreakonunhandledexception-flag?forum=winappswithcsharp


来自我的同事Rob的原始帖子:


" DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION默认情况下未设置。


如果已设置,那么您要么明确地这样做,要么使用设置它的包。


你可以在项目属性中设置您想要的任何条件编译符号。"



我希望这有帮助,


詹姆斯



Hi,

I have a slightly different problem, from my original post, why I open a new one.
I have huge problems with debugging my Windows Universal App (created two years ago for 8.1, but seems to work for Win10 as well). The solution consists of:

  • App1.Windows (Windows 8.1)
  • App1.WindowsPhone (Windows Phone 8.1)
  • App1.Shared
  • pcl (Portable)
  • WebApplication1

In Visual Studio 2015, in my App1.Shared code I call the API controller in WebApplication1, using code as:

HttpClient test = new HttpClient();
AppConstants.WebApiAddress = "http://localhost:56208";
Uri uriCall = new Uri(AppConstants.WebApiAddress + "/api/Login/"); string res = await test.GetStringAsync(uriCall);

When an error occur in my API, it always breaks on the following (if (global::System...) in app.g.i.cs:

#if DEBUG && !DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION
  UnhandledException += (sender, e) =>
  {
    if (global::System.Diagnostics.Debugger.IsAttached) global::System.Diagnostics.Debugger.Break();
  };
#endif

And the info I get about the error is almost nothing. In startup projects, I have set multiple projects to start App1.WindowsPhone, and WebApplication1. I call the api on http://localhost:56208.

I need to be able to set breakpoints, and the code to break on the line that raises the error in my API. Or at least the code in App1.WindowsPhone to break on the line that calls the api that raises the error.

Is there an easy way to solve this? Should I reinstall my Windows 10 computer and VS studio environment? It is a quite old installation upgraded from Windows 8.1, and Visual Studio 2013 (but now I use 2015).

I have messed around with debugging parameters and symbol settings, but to be honest, I don't understand so much of these settings. Could I reset all settings for VS?

Please help me out.
/Magnus

Hello Magnus,

Have you see this forum post?

https://social.msdn.microsoft.com/Forums/en-US/250e8e87-8eff-4af3-b957-2cf12d7ee89c/can-you-disable-the-disablexamlgeneratedbreakonunhandledexception-flag?forum=winappswithcsharp

From the original post by my colleague Rob:

"DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION is not set by default.

If it is set, then you're either doing so explicitly or using a package which is setting it.

You can set whichever conditional compilation symbols you want in Project Properties."

I hope this helps,

James


相关阅读

技术问答最新文章