Replace workaround with better solution

Thanks @mlehmk
This commit is contained in:
Drew DeVault 2015-06-18 12:53:24 -04:00
parent 73869d7123
commit ce4d662e67

View File

@ -10,14 +10,14 @@ namespace TrueCraft.Client
{ {
public static class Program public static class Program
{ {
[STAThread]
public static void Main(string[] args) public static void Main(string[] args)
{ {
AppDomain.CurrentDomain.AssemblyResolve += AppDomain_CurrentDomain_AssemblyResolve; AppDomain.CurrentDomain.AssemblyResolve += AppDomain_CurrentDomain_AssemblyResolve;
var thread = new Thread(() => Main_Thread(args)); // We need to run this in another method to avoid referencing MonoGame before registering
thread.SetApartmentState(ApartmentState.STA); // our AssemblyResolve handler
thread.Start(); Main_Thread(args);
thread.Join();
} }
static Assembly AppDomain_CurrentDomain_AssemblyResolve (object sender, ResolveEventArgs args) static Assembly AppDomain_CurrentDomain_AssemblyResolve (object sender, ResolveEventArgs args)