MethodDesc initApartmentState = startup?.GetMethod("InitializeApartmentState", null);
if (initApartmentState != null)
{
- if (_mainMethod.HasCustomAttribute("System", "STAThreadAttribute"))
+ if (_mainMethod.WrappedMethod.HasCustomAttribute("System", "STAThreadAttribute"))
{
codeStream.EmitLdc((int)System.Threading.ApartmentState.STA);
codeStream.Emit(ILOpcode.call, emitter.NewToken(initApartmentState));
}
- if (_mainMethod.HasCustomAttribute("System", "MTAThreadAttribute"))
+ if (_mainMethod.WrappedMethod.HasCustomAttribute("System", "MTAThreadAttribute"))
{
codeStream.EmitLdc((int)System.Threading.ApartmentState.MTA);
codeStream.Emit(ILOpcode.call, emitter.NewToken(initApartmentState));