[UWP]在Universal应用程序中调试Web应用程序 [英] [UWP] Debug a webapplication in Universal app

查看:76
本文介绍了[UWP]在Universal应用程序中调试Web应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我的
original发布
,为什么我要开一个新的。

调试我的Windows通用应用程序时出现了很大的问题(两年前创建的8.1版,但似乎也适用于Win10)。解决方案包括:




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

在Visual Studio 2015中,在我的App1.Shared代码中,我使用以下代码调用WebApplication1中的API控制器:

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


当我的API出现错误时,它总是在以下内容中断(if:global :: System ... ) 在app.gics中:

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

我得到的关于错误的信息几乎没有。在启动项目中,我设置了多个项目来启动App1.WindowsPhone和WebApplication1。我在http:// localhost:56208上调用api。 / p>

我需要能够设置断点,以及在我的API中引发错误的行中断的代码。或者至少App1.WindowsPhone中的代码打破了这一行调用引发错误的api。


有没有一种简单的方法可以解决这个问题?我应该重新安装我的Windows 10计算机和VS工作室吗? nvironment?这是一个从Windows 8.1和Visual Studio 2013升级的相当旧的安装(但现在我使用2015)。


我已经搞乱了调试参数和符号设置,但说实话,我不太了解这些设置。我可以重置VS的所有设置吗?


请帮帮我。

/ Magnus


解决方案

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


这篇关于[UWP]在Universal应用程序中调试Web应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆