I have a C # .NET assembly that is being called from a C ++ COM client. When the client process explicitly frees the COM object, the CCW release is an internal reference, which makes the .NET object suitable for garbage collection.
What if a .NET object has a static constructor that opens a log file? Is there an elegant solution to close a log file without an explicit request from a client?
TIA.
After some testing using AppDomain.ProcessExit, EventHandler seems like a good choice to close the log file.
COM-, . (, FileStream), GC Finalizer GC , CCW GC (s.)
-Oisin
Source: https://habr.com/ru/post/1729576/More articles:How can I make $ 1 alternatives without replacing regex? - perlCreating an Object to Work as a Delegate - Goal C - objective-cComprehensive SVN Validation Procedure? - eclipseWould Mercurial help me work with 2 PCs? - version-controlIs there a way to get the last character of a file without reading line by line? - c #Multiple multi-line regular expressions in bash - bashHow to mount network drives in the Delphi service? - delphiTransactional objects in .NET. - .netSelf Tracking Entities (STE) и частичные обновления с EF4 и mVC2 - .netSmart Grid Programming - electronicsAll Articles