I am working on SAP B1
Add-On using C#. When I call OpenFileDialog.ShowDialog()
this exception is thrown:
Current thread must be set to single thread apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThreadAttribute marked on it.
This exception is only raised if a debugger is attached to the process.
I added [STAThread]
before the Main
method but still have the same problem.