调试ASP.NET 5 IIS Express时无法监视变量的内容 [英] Cannot watch contents of variables when debuggin ASP.NET 5 IIS Express

查看:48
本文介绍了调试ASP.NET 5 IIS Express时无法监视变量的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我调试ASP.NET 5 Web应用程序时,它会遇到断点,但是我无法查看本地创建的变量的内容.

When I debug an ASP.NET 5 web application it hits my breakpoints, but I cannot watch the contents of variables created locally.

使用空项目作为模板的startup.cs中的示例代码:

Example code from startup.cs using empty project as template:

public void Configure(IApplicationBuilder app)
{
    app.UseIISPlatformHandler();
    var dummy = DateTime.Now;

    app.Run(async (context) =>
    {
        await context.Response.WriteAsync("Hello World! " + dummy);
    });
}

当我在"app.Run(....")上设置一个断点时,它会碰到断点,但是我看不到变量dummy的内容.如果我添加 dummy 来观看,它会显示错误CS0103:名称'dummy'在当前上下文中不存在" .尽管我可以看到DateTime.Now的内容,但是每次我将其悬停时都可以得到确切的日期和时间.当我在MVC控制器中放置一个断点并观察变量在那里时,也会发生同样的情况.

When I put a breakpoint on "app.Run(...." it hits the breakpoint but I cannot see the content of variable dummy. If I add dummy to Watch it says "error CS0103: The name 'dummy' does not exist in the current context". Although I can see the contents of DateTime.Now, which gives me the exact Date and Time every time I hover it. The same happens when I put a breakpoint in an MVC controller and watch variables overthere.

我正在学习Pluralsight课程,并且在学习该课程时创建的项目中也包含了此内容,以及课程附带的示例文件.

I was following a Pluralsight course and I also have this with the project I created while following that course, as well with the example files that come with the course.

在调试期间,VS2015附加到dnx.exe进程在视频中,我看到VS2015已附加到IISExpress.exe进程中.但是那门课是从十一月开始的.2015年可能与此同时有所改变.

During debug VS2015 is attached to the dnx.exe process In the video I see the VS2015 is attached to the IISExpress.exe process. But that course is from nov. 2015 perhaps something changed in the meanwhile.

重新启动计算机没有帮助.

Reboot of machine didn't help.

这是我在这里的第一个问题,如果需要更多信息,请告诉我,我会尽力提供.

This is my first question over here, if more info is needed please let me know, and I'll do my best to provide.

推荐答案

我找到了答案.有时一整夜的休息确实会带来奇迹.

I've found the answer. Sometimes a night of rest does miracles.

我在Google搜索中搜索了错误CS0103:该名称在当前上下文调试中不存在".没有调试"这个词,您会得到很多无济于事的结果.我找到了以下网站:

I did a Google search on 'error CS0103: The name does not exist in the current context debug'. Without the word 'debug' you get a lot of results that don't help. I've found the following site: https://connect.microsoft.com/VisualStudio/feedback/details/1038150/visual-studio-2015-debugger-doesnt-recognize-a-variable

答案是:菜单>调试>选项,使用托管的兼容模式".选中该选项,它对我有用.也是我正在从事的项目.

The answer is: Menu > Debug > Options, "Use Managed Compatibility Mode". Checked that option and it worked for me. Also for the project I was working on.

这篇关于调试ASP.NET 5 IIS Express时无法监视变量的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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