????? ???? ???? ???????? ??? STA ?? ????? ????? ?????? COM ? ?? ????? ????????? ??? ?????? Finalize ???????? ???? ???? ?????? ???? ???????? ???????

?????? ????????? ?????? ?????????
???? ???????: 828988 - ??? ???????? ???? ????? ????? ??? ???????.
????? ???? | ?? ????

???????

?? ???? ????? ???? ???? ???????? ??? ??? ????? ???? (STA) ?????? ?? ?????? ?????? ???? ???? ?????? (COM) STA ? ?? ??????? ???? ????? ?????? ????? ???? ????? COM ??? ??????? ??????? Monitor.Enter ????? Thread.Join ? ???????? ?? ???? ??????? ???????. ?????? ??? ??? ??????? ???? ????? ???????? ???? ???? ???? ????? ? ???? ???? ????? ??? ??????? ??????? Console.ReadLine ?? ???? ??????? ???????:
  • ?? ??? ????? ????? ?????? COM.
  • ?? ??? ????? ????????? ??? ?????? Finalize ???????? ???? ???? ?????? ???? ???????? ???????.
  • ?? ????????? ??? ?????? COM ??? ???? ????? ??????? ?????? ??? ????? ?????.
  • ?? ???? ????? ??????? ???? ??????? ????? ??????? STA ??? ?????.
  • ?? ?????? ????????? ????? GC.WaitForPendingFinalizers ????? ?????? ??????.

?????

?????? ??????? ???? COM STA ???? ????? ??? ?? ??? ??????? ?????? ?????? ? ???? ??????? ???? ?? ?????? ?????? ??? ?? ???? ?? ???????. ????? ???? ??????? ?????? ??? ??????? ?? ??? ???? COM ? ???? ??? ??? ?? ???? ????? finalizer ??? ??????? ??????? ??????? ??????. ??? ???? ??? ?? ??? ???? ??????? STA ??? ?? ????? ?????? ?? ????? ? ??? ??????? ??????? ??? ???? ??????? ???? ?? ??????? ??? ????. ??? ????????? ????? ?????? ?? ?????? COM ????????? ???? ???? ??????. ?? ??? ????????? ??? ??? ???? ??????? finalizer ????? ?????? ?? ????? ??? ????? STA ???? ????? ????? ???? ? ?? ?? ????? ???? ????? finalizer ?? ?????? ???? ????? ??. ????? ??? ?? COM ?????? ??? ????? "?" ????? ???????? ???? ??? ??????? ?????? ?? ????? ???? ??? ?????. ?? ???? ???? ??? ???????? ?? ???? ????? ??????? ???? ??????? ????? ??????? STA ??? ?????. ?????? ?? ???? ?? ???? ????? ??????? ??????? GC.WaitForPendingFinalizers ???? ??? ?????.

?? ???? ??? ?? ???? ???? ?????/????? (IO) ?????? ???? ???????? ??? ReadFileWriteFile ???????. ???? Console.ReadLine ????? ??? API ReadFile ?? ???? ??????? ? Console.ReadLine ?? ????? ???? ?? ???. ?????? ???? ???? ??????? ???? ?????? Console.ReadLine ?? ??????? ????? ????????.

????

??? ??? ???????? ?????? ?????? ????? MTA ????? ?? ?????? ??????? STA ?????? ??????? ?? ?????? COM ?? ??????? ???? ??????. ????? ????? ???? ??????? ??????? ??????? MTA. ?????? ????? ????? System.MTAThread ????? ??????? ??????? ??? ???: ????? ??????
public class ConsoleApplication
             {
                 [MTAThread]
                 static void Main()
                 {
                     // Add your code here.
                     Console.ReadLine();
                 }
} 
??? ??? ???? ??????? ?????? ??????? STA ????? ?????? COM ?????? ??????? STA ??? ?? ???? ????? ???? ?????. ???? ????? ????? ????? ?? ??????? ??????? Thread.Join ? ??? ???:
Thread.CurrentThread.Join(100)
??????? ??? ??????? pumps ????? 100 ???? ?????. ????? ??? ?????? ???????? ??? ??????? ???????. STA ?????? ??? ?? ???? ????? ???? ??????? unbounded ??? ?? ?????? ??? ??????? Console.ReadLine. ????? ?? ???? ??? ?? ???? ???? ??????? STA ???? ????? MTA ????? ??????? ?? ???????? ??? ?????? ???????.

?????


????? ?? ????????? ??? ??????? ?? ???? Microsoft .NET Framework ?? ?????? ???? Microsoft ?????? ??? ?????:
http://msdn2.microsoft.com/en-us/library/1912sb9w(vs.71).aspx
????? ?? ????????? ??? ??????? ?? .NET Framework ?????? ????? Microsoft ??????? ??? ?????:
http://msdn.microsoft.com/msdnmag/issues/1100/gci/
http://msdn.microsoft.com/msdnmag/issues/1200/GCI2/

?????? ??? ??????? ?????? ??? ??? ????????? ?? ???? STA ???? ??? ??? ??????? ?????? ?????? ?? "????? ??????? ?? Microsoft:
291837INFO: ?? ????? ??????? ??? ?? ???? STA

???????

???? ???????: 828988 - ????? ??? ??????: 18/?? ?????/1424 - ??????: 1.4
????? ???
  • Microsoft .NET Framework 1.1
  • Microsoft .NET Framework 1.0
????? ??????: 
kbmt kbgarbagecollect kbremoting kbprb KB828988 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????828988

????? ???????

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com