未验证 提交 44d0cfed 编写于 作者: E Elinor Fung 提交者: GitHub

Initialize main thread to MTA by default in NativeAOT (#73659)

上级 a3fb0d38
......@@ -77,7 +77,7 @@ public override MethodIL EmitIL()
codeStream.Emit(ILOpcode.call, emitter.NewToken(method));
}
}
MetadataType startup = Context.GetOptionalHelperType("StartupCodeHelpers");
// Initialize command line args if the class library supports this
......@@ -110,8 +110,9 @@ public override MethodIL EmitIL()
codeStream.EmitLdc((int)System.Threading.ApartmentState.STA);
codeStream.Emit(ILOpcode.call, emitter.NewToken(initApartmentState));
}
if (_mainMethod.WrappedMethod.HasCustomAttribute("System", "MTAThreadAttribute"))
else
{
// Initialize to MTA by default
codeStream.EmitLdc((int)System.Threading.ApartmentState.MTA);
codeStream.Emit(ILOpcode.call, emitter.NewToken(initApartmentState));
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册