I have a C # class that I need to open as COM. A tool that will use a COM object requires STA support. Is there anything special I need to do with my COM object?
(I know about the STAThread attribute, but (if I'm not mistaken) This indicates that the .net thread should be compatible with the STA, and not to indicate that my COM object should be compatible).
Here is my declaration so far. Do you see anything I need to add?
[ComVisible(true)] [ClassInterface(ClassInterfaceType.None)] [ComDefaultInterface(typeof(ITestClass1))] [Guid("093A3701-2C53-4A31-97C5-0F3C205E5B4C")] public class Class1: ITestClass1 {..} [ComVisible(true)] [Guid("8D52F785-CDD8-4248-8AB7-97B8C19DE59B")] public interface ITestClass1 {..}
COM- ThreadingModel. Single threaded , "".
Regasm.exe "Both". , STA MTA. , .NET , , . , [ComRegisterFunction].
, "Both", . Thread.GetCurrentThread(). GetApartmentState(). MTA, , , . .NET- .
. ComRegisterFunction, voodoo. , - , , STA, COM-, STA.
Source: https://habr.com/ru/post/1755338/More articles:What is a good and simple middleware? - compiler-constructionDoes CouchDB Databases Extremely Large in a Short Span of Time? - couchdbschedule database schema - database-designCSS error with title and lack of proper space between table and page border - htmlWhich virtual python environment and deployment solution should I use? - pythonHexadecimal floating point - numbersRefactoring two methods with almost identical content - c #Heroku installation on Ubuntu Lucid Lynx broken - ruby-on-railsWhy do I have memory leaks using tools on the device, but not on the simulator - debuggingCriticism of my prime_factors () function - pythonAll Articles