我发生了一个异常。我怎么解决它? [英] I have occured an exception.How can I fix It?

查看:89
本文介绍了我发生了一个异常。我怎么解决它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

附加信息:在进行OLE调用之前,必须将当前线程设置为单线程单元(STA)模式。确保您的Main函数标记了STAThreadAttribute。仅当调试器附加到进程时才会引发此异常。

解决方案

如果收到错误消息,请不要理解,首先将其传递给Google: Google当前主题必须设置为...附加到流程 [ ^ ]

很可能无论你有什么消息,已经多次得到解释,解释和修复之前 - 就像这里的情况一样。



关注一些链接,看看他们说了什么。或者在这种情况下,确切地执行错误消息告诉您的操作,并将STAThreadAttribute应用于您的Main函数:

  static   class 计划
{
/// < 摘要 > ;
/// 应用程序的主要入口点。
/// < / summary >
[STAThread]
static void Main()
{
...
}
}


谢谢你的工作......................... .................................................. .............................................

Additional information: Current thread must be set to single thread apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThreadAttribute marked on it. This exception is only raised if a debugger is attached to the process.

解决方案

If you get an error message you don;t understand, start by passing it to Google: Google "Current thread must be set to ... is attached to the process"[^]
It's very likely that whatever message you have, has been met, explained, and fixed many times before - as is the case here.

Follow some of the links and see what they say. Or in this case, do exactly what the error message tells you to do, and apply the STAThreadAttribute to your Main function:

static class Program
    {
    /// <summary>
    /// The main entry point for the application.
    /// </summary>
    [STAThread]
    static void Main()
        {
        ...
        }
    }


thank you it works........................................................................................................................


这篇关于我发生了一个异常。我怎么解决它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆