Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6469115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T05:57:14+00:00 2026-05-25T05:57:14+00:00

This is part of my Main method: [STAThread] static void Main(string[] args) { #if

  • 0

This is part of my Main method:

[STAThread]
static void Main(string[] args)
{
   #if !DEBUG
   try
   {
   #endif
   ApartmentState aps = System.Threading.Thread.CurrentThread.GetApartmentState();
   //System.Threading.Thread.CurrentThread.SetApartmentState(ApartmentState.STA);
   MessageBox.Show(aps.ToString());

The message shows MTA. Any idea why or where should I start investigating?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T05:57:15+00:00Added an answer on May 25, 2026 at 5:57 am

    Were you just curious, or was it causing some other issue? Usually it’s only a problem if you are trying to do some types of COM interaction in your main method. Windows will still run in the appropriate ApartmentState.

    I haven’t checked lately, but it used to be that regardless of the attribute, Visual Studio forced MTA. Did you try to run your application from outside of Visual Studio?

    If it is only a problem in the debugger, uncheck “Enable the Visual Studio hosting process” under the Debug section of your project’s properties.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This part of my code works fine: #include <stdio.h> int main(){ //char somestring[3] =
Got this code in my controllers (void)viewDidLoad method self.purchasesPerClassification = [NSMutableDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@Moo,nil] forKeys:[NSArray
It seems that this part of my code is where the exception occurs: c
I have been putting off developing this part of my app for sometime purely
I am trying to learn and writting this part of code. while testing few
I just started learning C but I don't understand this part of the code.
The code we're using is straightforward in this part of the search query: myCriteria.Add(
I'd like to know what you think about this part of our program is
Reading Java Concurrency In Practice, there's this part in section 3.5: public Holder holder;
Hi I need a regular expression that'll give me something like this part ./something\,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.