Skip to content

Run the COMServer single Apartment state (STA)? #1

@Daniela88888

Description

@Daniela88888

Is there any chance to run the COM server as in STA mode?
I tried these hints found on the internet:

  • add [STAThread] to the Main method
  • derive SimpleObject from StandardOleMarshalObject

But the SimpleObject is always created in MTA state . The documentation says that the apartment state of the created object is overtaken from the calling thread. SimpleObject is created in the callback method SimpleObjectClassFactory,CreateInstance which is called outside of the scope of CSExeCOMServer.Program.

Does anyone have a solution?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions