简体   繁体   English

在 Visual Studio 2019 中调试大多数变量时出现错误 CS0103

[英]Error CS0103 when debugging most variables in Visual Studio 2019

I am trying to debug code in a cshtml file.我正在尝试调试 cshtml 文件中的代码。 I set a breakpoint and it breaks.我设置了一个断点,它会中断。 But when I try to watch a variable it gives the CS0103 error.但是当我尝试观察一个变量时,它会给出 CS0103 错误。 This is happening all the time not just in this part of the code.这种情况一直在发生,而不仅仅是在这部分代码中。

I have set it to use managed compatibility and made sure I am in debug instead of release.我已将其设置为使用托管兼容性,并确保我处于调试而不是发布状态。 I have looked at it on google and it is set up the way it should be as far as I know.我在谷歌上看过它,据我所知,它的设置方式应该是这样的。 I am a newbie to C# and debugging cshtml files.我是 C# 和调试 cshtml 文件的新手。

if (@Model.GranteeDeed1 > 0) {
    var fe = fundEntities.filter(function(obj) { return obj.FundEntityID == @Model.GranteeDeed1; });
    $("#lblGranteeDeed1").text(fe[0].EntityName);
    $("#txtGranteeDeed1 option[value='" + fe[0].FundEntityID  + "']").attr("selected", "selected");
}

I want to see the value of either obj.FundEntityID or (fe[0].EntityName).我想查看 obj.FundEntityID 或 (fe[0].EntityName) 的值。 I can see the value of @Model.GranteeDeed1.我可以看到@Model.GranteeDeed1 的值。

Both of those two variables appear to be Javascript.这两个变量似乎都是 Javascript。 You will want to use the developer tool in your browser (F12 in Chrome/Firefox/Edge on Windows, not sure what the equivalent is on Mac).您将希望在浏览器中使用开发人员工具(Windows 上的 Chrome/Firefox/Edge 中的 F12,不确定 Mac 上的等价物)。 In Chrome it's the "Sources" tab and in Firefox it's the "Debugger" tab.在 Chrome 中是“源”选项卡,在 Firefox 中是“调试器”选项卡。

Here are some links:以下是一些链接:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM