Browse Source

Modified the ControlCatalog examples to run in STA ApartmentState

boombuler 7 years ago
parent
commit
c1abc05355

+ 1 - 0
samples/ControlCatalog.Desktop/Program.cs

@@ -10,6 +10,7 @@ namespace ControlCatalog
 {
 {
     internal class Program
     internal class Program
     {
     {
+        [STAThread]
         static void Main(string[] args)
         static void Main(string[] args)
         {
         {
             // TODO: Make this work with GTK/Skia/Cairo depending on command-line args
             // TODO: Make this work with GTK/Skia/Cairo depending on command-line args

+ 2 - 0
samples/ControlCatalog.NetCore/Program.cs

@@ -9,8 +9,10 @@ namespace ControlCatalog.NetCore
 {
 {
     static class Program
     static class Program
     {
     {
+        
         static void Main(string[] args)
         static void Main(string[] args)
         {
         {
+            Thread.CurrentThread.TrySetApartmentState(ApartmentState.STA);
             if (args.Contains("--wait-for-attach"))
             if (args.Contains("--wait-for-attach"))
             {
             {
                 Console.WriteLine("Attach debugger and use 'Set next statement'");
                 Console.WriteLine("Attach debugger and use 'Set next statement'");