debuggingcomvisual-studio-2019sap-business-one-di-api

Cannot inspect Sap B1 SDK objects while debugging in Visual Studio 2019


I am working with Visual Studio 2019 Community Edition Version 16.7.2.

I have referenced the SapBusinessOneSDK.dll inside a .Net Core Console Application to access SAP B1 via DI API and I am not able to inspect any Sap B1 COM Object while debugging. The error appearing is:

“The function evaluation requires all threads to run.”

enter image description here

This are the project properties of the mentioned Console App in the Debug Section:

enter image description here

And this are the Visual Studio Options relevant to Debugging:

enter image description here

How should I proceed?

Thanks


Solution

  • Thanks for Hans sharing the useful workaround and add it as an answer to manage this issue better.

    Since you have reference a com component dll on a console app and Console mode apps are usually a hostile locations place for COM components, you should add the [STAThread] to get into it.

    [STAThread]
    static void Main(string[] args)
    {
    
    // any code
    
    
    }