SetApartmentState(ApartmentState state).Ensure that your Main function has STAThreadAttribute marked on it. This exception is only raised if a debugger is attached to the process
System.Threading.ThreadStateException: '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.'
Thread exportThread = new Thread(() =>
{ });
exportThread.SetApartmentState(ApartmentState.STA);
Sets the apartment state of a thread before it is started.
[SecuritySafeCritical]
public void SetApartmentState(ApartmentState state);
SetApartmentState(ApartmentState state).Ensure that your Main function has STAThreadAttribute marked on it. This exception is only raised if a debugger is attached to the process的更多相关文章
- The App Life Cycle & The Main Function
The App Life Cycle Apps are a sophisticated interplay between your custom code and the system framew ...
- [Cycle.js] Customizing effects from the main function
How can we show one string on the DOM, and a completely different string on Console log? This lesson ...
- [Cycle.js] Main function and effects functions
We need to give structure to our application with logic and effects. This lessons shows how we can o ...
- Main function
Main function A program shall contain a global function named main, which is the designated start of ...
- 选择目录,选择文件夹的COM组件问题。在可以调用 OLE 之前,必须将当前线程设置为单线程单元(STA)模式。请确保您的 Main 函数带有 STAThreadAttribute 标记。 只有将调试器附加到该进程才会引发此异常。
异常: 在可以调用 OLE 之前,必须将当前线程设置为单线程单元(STA)模式.请确保您的 Main 函数带有 STAThreadAttribute 标记. 只有将调试器附加到该进程才会引发此异常. ...
- 在可以调用OLE之前,必须将当前线程设置为单线程单元(STA)模式,请确保您的Main函数带有STAThreadAttribute
导入导出功能,在调用ShowDialog时的错误,解决办法如下: WinForm窗体的入口点: /// <summary> /// 应用程序的主入口点. /// </summary& ...
- c# Clipboard.SetDataObject(bmp1) 在可以调用 OLE 之前,必须将当前线程设置为单线程单元(STA)模式。请确保您的 Main 函数带有 STAThreadAttribute 标记。 只有将调试器附加到该进程才会引发此异常
c# Clipboard.SetDataObject(bmp1) 在可以调用 OLE 之前,必须将当前线程设置为单线程单元(STA)模式.请确保您的 Main 函数带有 STAThreadAttri ...
- Parse the main function arguments
int main(int argc, char **argv) { std::string reportDir; std::string transURL; std::string visualEle ...
- Insert Function before and after main function
Source code: 1: #include<stdio.h> 2: void myStartupFun (void) __attribute__ ((constructor)); 3 ...
随机推荐
- 我用python爬取了知乎Top沙雕问题排行榜
前言 本文的文字及图片来源于网络,仅供学习.交流使用,不具有任何商业用途,版权归原作者所有,如有问题请及时联系我们以作处理. 作者: 数据森麟 PS:如有需要Python学习资料的小伙伴可以加点击下方 ...
- MySQL学习——操作存储过程
MySQL学习——操作存储过程 摘要:本文主要学习了使用DDL语句操作存储过程的方法. 了解存储过程 是什么 存储过程是一组为了完成特定功能的SQL语句集合. 使用存储过程的目的是将常用或复杂的工作预 ...
- fatal error: iconv.h: No such file or directory
CodeLite CodeLite编译(使用Cygwin Toolchain)出现如下错误: fatal error: iconv.h: No such file or directory 解决办法 ...
- 详细设计文档(final)
1. 引言 1.1编写目的 本部分旨在阐明编写详细设计的目的,面向读者对象. 本文档主要描述各个模块的细节设计,明确软件的结构与实现过程,分析各个模块,描述模块的功能.性能和结构等方面包括模块接口.调 ...
- emacs require和provide
Emacs的默认配置文件是.emacs,Emacs启动时会读取并执行.emacs中的LISP代码,用户使用.emacs达到自己的Emacs初始化配置目的. 不过单独使用.emacs有一个问题,因为时间 ...
- vue 表格组件 有事件交互(二)
04==>v-if下面可以嵌套 同级的 v-if 和v-node如下若是第一个v-if没有下面的就不可能显示出来的. <span v-if="!single" @cli ...
- 数据分析三剑客 numpy,oandas,matplotlib(2)
Pandas的数据结构 导入pandas: 三剑客 import pandas as pd from pandas import Series,DataFrame import numpy as n ...
- Java实现单词自定义排序|集合类、工具类排序、comparable、comparator接口
课题 针对单词进行排序,先按字母的长度排序,长者在前: 在长度相等的情况下,按字典降序排序. 例如,有单词序列"apple banana grape orange",排序后输出结果 ...
- 攻防世界web-unserialize3
漏洞编号CVE-2016-7124 详情 https://xz.aliyun.com/t/378 题目源码 class xctf{ '; public function __wakeup(){ ex ...
- monkey参数
一.参数分类 常规类参数:包括帮助参数和日志信息参数. 帮助类参数:monkey -h -- 输出monkey命令使用指导 日志信息参数:monkey -v <event-count&g ...