无法在Visual Studio 2019 Community edition 16.7.2中使用外部应用程序调试c#dll项目

无法在Visual Studio 2019 Community edition 16.7.2中使用外部应用程序调试c#dll项目,c#,visual-studio,visual-studio-debugging,amibroker,C#,Visual Studio,Visual Studio Debugging,Amibroker,这个项目是一个“amibroker插件”,使用kriasoft的amibroker.NETSDK在C#中开发 我有“构建”我的插件,当我在“控制台项目”中测试它时,它运行良好。但当我尝试用外部应用程序(Amibroker.exe)调试它时,VisualStudio突然关闭,几秒钟后启动一个空白的VisualStudio窗口,其中有一个选项“附加”,而不是我们通常看到的运行项目的“开始” 我单击了attach选项并连接到我的amibroker应用程序,它成功地显示了“Debug.Writeline

这个项目是一个“amibroker插件”,使用kriasoft的amibroker.NETSDK在C#中开发

我有“构建”我的插件,当我在“控制台项目”中测试它时,它运行良好。但当我尝试用外部应用程序(Amibroker.exe)调试它时,VisualStudio突然关闭,几秒钟后启动一个空白的VisualStudio窗口,其中有一个选项“附加”,而不是我们通常看到的运行项目的“开始”

我单击了attach选项并连接到我的amibroker应用程序,它成功地显示了“Debug.Writeline()”消息。但是我的断点没有一个被击中。我的代码在任何窗口中都不可见,就像调试控制台应用程序时一样

在谷歌进行研究后,我发现外部应用程序应该由VisualStudio自动启动,并且应该在我的断点处停止。我的情况并非如此。我已经搜索了很多,甚至更新了整个vs2019,但没有任何进展

如果有人能帮我,那就太好了

注意:“不调试启动”工作正常

有关“无法加载文件或程序集”System.Text.Json的新信息: 无法加载文件或程序集“System.Text.Json,Version=4.0.1.1,Culture=neutral,PublicKeyToken=CC7B13FFCD2DD51”或其依赖项之一。系统找不到指定的文件

错误:510 LOG:DisplayName=System.Text.Json,版本=4.0.1.1, 区域性=中性,PublicKeyToken=CC7B13FFCD2DD51(完全指定) 日志:Appbase=file:///C:/Program 文件(x86)/AmiBroker\u New\u 6.0/LOG: 初始PrivatePath=NULL调用程序集:(未知)。错误:510日志: 此绑定在默认加载上下文中启动。日志:没有应用程序 找到配置文件。日志:使用主机配置文件:日志: 使用来自的计算机配置文件 C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config。 日志:发布策略参考:System.Text.Json,版本=4.0.1.1, 区域性=中性,PublicKeyToken=CC7B13FFCD2DD51日志:正在尝试 下载新网址file:///C:/Program 文件夹 (x86)/AmiBroker_New_6.0/System.Text.Json.DLL。日志:正在尝试下载 新网址的更新file:///C:/Program 文件夹 (x86)/AmiBroker_New_6.0/System.Text.Json/System.Text.Json.DLL。日志: 正在尝试下载新的URLfile:///C:/Program 文件夹 (x86)/AmiBroker_New_6.0/System.Text.Json.EXE。日志:正在尝试下载 新网址的更新file:///C:/Program 文件夹 (x86)/AmiBroker_New_6.0/System.Text.Json/System.Text.Json.EXE

My packages.config条目:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="CsvTextFieldParser" version="1.2.1" targetFramework="net461" />
  <package id="Microsoft.Bcl.AsyncInterfaces" version="1.1.0" targetFramework="net461" />
  <package id="System.Buffers" version="4.5.1" targetFramework="net461" />
  <package id="System.Memory" version="4.5.4" targetFramework="net461" />
  <package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net461" />
  <package id="System.Runtime.CompilerServices.Unsafe" version="4.7.1" targetFramework="net461" />
  <package id="System.Text.Encodings.Web" version="4.7.1" targetFramework="net461" />
  <package id="System.Text.Json" version="4.7.1" targetFramework="net461" />
  <package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net461" />
  <package id="System.ValueTuple" version="4.5.0" targetFramework="net461" />
  <package id="UnmanagedExports" version="1.2.7" targetFramework="net461" />
</packages>

app.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <probing privatePath="ghyiouys\;Plugins\;plugins;"/>
            <dependentAssembly>
                <assemblyIdentity name="System.Text.Json" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
                <bindingRedirect oldVersion="0.0.0.0-4.0.1.1" newVersion="4.0.1.1" />
                <codeBase version="4.0.1.1" href="Plugins/System.Text.Json.dll"/>
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
                <bindingRedirect oldVersion="0.0.0.0-4.1.4.0" newVersion="4.1.4.0" />
                <codeBase version="4.1.4.0" href="Plugins/System.Numerics.Vectors.dll"/>
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
                <bindingRedirect oldVersion="0.0.0.0-4.0.6.0" newVersion="4.0.6.0" />
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
                <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
                <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
            </dependentAssembly>
        </assemblyBinding>
    </runtime>
</configuration>

无法在Visual Studio中使用外部应用程序调试c#dll项目 2019社区版16.7.2

如果您只想通过一个VS在调试过程中与外部程序一起进入断点,则无法完成,因为VS无法通过外部程序加载pdb文件。而不调试启动将不会加载pdb文件以使其正常工作

作为建议

您还必须启动一个新的vs实例,以便同时通过“附加到进程”调试项目

使用第二个建议将实现它

1)首先,您应该检查您的额外计划:

启动外部程序
Amibroker.exe
的完整路径,命令行参数包含VS中当前项目Amibroker插件的名称

然后,取消选中工具-->选项-->调试-->常规下的“仅启用我的代码”选项

2)秒,记得添加
Debugger.Launch()如下所示:

 static void Main(string[] args)
        {
            Debugger.Launch();

            //add any code here

        }
3)第三个,单击
开始调试
,然后打开调试窗口模块,然后搜索有关
Amibroker
的任何DLL,然后右键单击它们-->始终自动加载

4)第四个,停止调试过程,然后删除
bin
obj
文件夹。之后,再次单击“开始调试”
,稍等片刻,您可以看到关于选择“实时调试程序”
窗口的窗口。您应该选择VS2019 IDE,它通过
附加到进程中
使用当前项目启动一个新的vs实例。使用它,您可以进入断点调试代码

或者您可以尝试我的第二个建议,自动启动流程。

注意:第二个建议将同时通过amibroker插件项目创建一个新的VS实例

===========================================

除了之外,如果您仍然面临相同的问题,请尝试禁用扩展菜单下的任何第三方扩展-->管理扩展,以检查是否存在导致此问题的原因

通过工具重置所有VS设置选项-->导入和导出设置-->重置所有设置,然后禁用选项仅启用我的代码选项

还有,有。