static void Main(string[] args)
        {
            Thread thread = new Thread(
                () =>
                    {
                        SnapinWrapper wrapper = new SnapinWrapper();
                        Thread.Sleep(Timeout.Infinite);
                    });
            thread.SetApartmentState(ApartmentState.STA);
            thread.Start();

            while (true)
            {
                ExpensiveResource r = new ExpensiveResource();
                r.Use();
            }
        }
        static void Main(string[] args)
        {
            Thread thread = new Thread(
                () =>
            {
                SnapinWrapper wrapper = new SnapinWrapper();
                Thread.Sleep(Timeout.Infinite);
            });

            thread.SetApartmentState(ApartmentState.STA);
            thread.Start();

            while (true)
            {
                ExpensiveResource r = new ExpensiveResource();
                r.Use();
            }
        }