c# - 如何修复 C# 中的 'Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack' 错误

标签 c# asp.net

我正在调用一个异步调用另一个方法的方法(使用委托(delegate))..但是它没有按预期工作..抛出这个

Unable to evaluate expression because the code is optimized or a 
native frame is on top of the call stack'` exception..

请大家帮忙

下面是我调用的方法

public bool ProcessInvoices(string printGroupId, bool isControlNum)
{
    //Create delegate for asynchronous operation
    ProcessInvoicesDelegate _processInvoicesDelegate = new ProcessInvoicesDelegate(ProcessInvoicesFromCABSToExstream);
    IAsyncResult result = _processInvoicesDelegate.BeginInvoke(printGroupId, isControlNum, null, null);
    return true;
}

最佳答案

这只出现在“监视”窗口中,对吧?如果启用了构建属性中的“优化代码”标志,则某些变量实际上不再存在。默认情况下,这对于调试构建是禁用的,对于发布构建是启用的,但可以修改。

关于c# - 如何修复 C# 中的 'Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack' 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58797583/

相关文章:

c# - DataGrid 计算列

c# - 使用反射在运行时创建动态泛型

c# - 是否可以在没有 MAC 的情况下使用(Xamarin 和 visual studio)在 Windows 上开发 iOS App

c# - asp.net文件上传

asp.net - IE7 iframe 文件发布在服务器端向文件添加 header 信息

c# - 依赖注入(inject)/SOLID 担忧

c# - 以编程方式绑定(bind) GridViewComboBoxColumn 数据源

android - 在 Android 中使用带有 Post Params 的 WCF Web 服务

javascript - 如何在 Javascript 中获取相对路径?

mysql - 周期性 MySql 超时,然后是 ASP.NET 网站中的连接峰值