格式太旧或是类型库无效。 (Exception from HRESULT: 0x80028019 (TYPE_E_UNSUPFORMAT))
错误提示信息
格式太旧或是类型库无效。 (Exception from HRESULT: 0x80028019 (TYPE_E_UNSUPFORMAT)) 。
Old format or invalid type library. (Exception from HRESULT: 0x80028018 (TYPE_E_INVDATAREAD))。
出现时间
并行大批量数据处理操作时随机出现(使用的是ArcGIS COM库)。
原因:
这是网络中找到的使用Excel进行COM对象互操作时的解释:
After digging the internet I found out that there is a bug in Microsoft Interop with COM objects (at least with my case which is MS Excel 2010).
The bug is that .NET checks that your thread (C# or VB code) localization is suitable to MS Excel localization you installed earlier, and if not it tells that the Microsoft.Office.Interop library is old or invalid.
Your thread localization is derived from your computer regional settings (from the control panel --> regional and language)
Then there are two options to solve this problem:
- To change your thread localization (by code)
- Install language pack for your Office
解决方案:
线程启动时,设置当前线程的CultureInfo与互操作库一致。
When a thread is started, its culture is initially determined by using GetUserDefaultLCID from the Windows API. I found no way (I assume there is no way) to override this behavior. Only thing you can do is to set the thread culture afterwards.
I wrote an extension. For that:
public static class ParallelQueryCultureExtensions
{
public static ParallelQuery<TSource> SetCulture<TSource>(this ParallelQuery<TSource> source, CultureInfo cultureInfo)
{
SetCulture(cultureInfo);
return source
.Select(
item =>
{
SetCulture(cultureInfo);
return item;
});
}
private static void SetCulture(CultureInfo cultureInfo) {
if (Thread.CurrentThread.CurrentCulture != cultureInfo) {
Thread.CurrentThread.CurrentCulture = cultureInfo;
}
}
}
So if you use it just after splitting up the original source using .AsParallel() you will get what you want.
注:
当内存溢出时,也可能导致该错误的出现。
格式太旧或是类型库无效。 (Exception from HRESULT: 0x80028019 (TYPE_E_UNSUPFORMAT))的更多相关文章
- "格式太旧或是类型库无效。 (异常来自 HRESULT:0x80028019 (TYPE_E_UNSUPFORMAT))"
错误提示内容: “System.Runtime.InteropServices.COMException (0x80028019): 格式太旧或是类型库无效. (异常来自 HRESULT:0x8002 ...
- 错误信息:内存位置访问无效。 (Exception from HRESULT: 0x800703E6)
错误提示: 错误信息:内存位置访问无效. (Exception from HRESULT: 0x800703E6) 异常类型:System.BadImageFormatException 堆栈跟踪: ...
- Delphi COM编程技术三类型库(库文件中的工具栏,很全)
在COM组件的使用和开发过程中经常需要获取有关组件的信息.而COM组件以二进制代码的形式发布,如果不借助特定的工具这些相关信息将难以被获取.通过访问类型库就可以查看COM组件的信息. 一.类型库的基础 ...
- [转]如何使用MFC和类型库创建自动化项目
本文转自:http://www.cnblogs.com/zhoug2020/archive/2012/04/01/2429064.html 摘要 本文详细介绍了如何自动化像Microsoft Offi ...
- 不同格式图片相互转换的开源库分享(使用CxImage,并有VC6的配置过程)
不同格式图片相互转换的开源库分享 一.背景 笔者在项目的开发中,需要调用windows下的COM接口SetIconLocation来实现桌面快捷方式.而我们项目中给定的图片格式为png格式,SetIc ...
- 试图加载格式不正确的程序。 (Exception from HRESULT: 0x8007000B)
原文:试图加载格式不正确的程序. (Exception from HRESULT: 0x8007000B) 今天在电脑上部署公司的项目,出现这个错误.Bing后,找到原来是因为项目是32位的,而我的系 ...
- net 试图加载格式不正确的程序。(Exception from HRESULT: 0x8007000B)
原文:net 试图加载格式不正确的程序.(Exception from HRESULT: 0x8007000B) Server Error in '/' Application. 试图加载格式不正确的 ...
- 解决 “MoveFile”: 类型库“XXX.dll”中的标识符已经是宏;使用“rename”限定符 类型库符号与系统符号冲突问题
今天在VS工程当中引入一个组件,编译的时候出现警告, “MoveFile”: 类型库“XXX.dll”中的标识符已经是宏:使用“rename”限定符.虽然只是一个警告,但看着实在不爽,更重要的是,警告 ...
- 获取COM组件类型库信息
类型库type library的作用是什么? 用来描述这个COM组建的接口信息,比如有多少个接口,每个接口有什么函数,函数的描述之类的.MSDN查一下ITypeLib,ITypeInfo,TypeAt ...
随机推荐
- c#打印机设置,取得打印机列表及相应打印机的所有纸张格式
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...
- 纯CSS的颜色渐变效果
本例展示了一个纯css渐变的效果.其兼容IE6以上浏览器等各主流浏览器: 案例效果:查看演示 代码如下: css: *{margin:0;padding:0;} .linear{ width:100% ...
- html总结----------------------看这个就够了
HTML是我们学习Javaweb的第一步 很好地掌握门课是非常有必要的!下面就是我在听资深老师讲课的笔记!个人觉得非常不错!希望可以帮助到那些在学习javaweb路上的 朋友们!从今天 陆续的整理这门 ...
- 【HTML】Intermediate6:Text: Addresses, Definitions, Bi-directional, and Editorial
1.</address> It should be used specifically for the contact details relating either to the ent ...
- insertion Sort List (链表的插入排序) leecode java
逻辑简单,代码难写,基础不劳,leecode写注释不能出现中文,太麻烦,我写了大量注释,链表问题最重要的就是你那个指针式干啥的 提交地址https://oj.leetcode.com/problems ...
- vijosP1137 组合数
vijosP1137 组合数 链接:https://vijos.org/p/1137 [思路] 唯一分解定理. 简化式子为 : C = (n*…*m) / (n-m)!. 题目要求C质因子的数目,在质 ...
- 决策树及其python实现
剪枝 由于悲观错误剪枝 PEP (Pessimistic Error Pruning).代价-复杂度剪枝 CCP (Cost-Complexity Pruning).基于错误剪枝 EBP (Error ...
- HDOJ-ACM1020(JAVA)
题意:给字母计数,如果是字母后面没有相同的,原样输出,如果有则输出这个字母的个数和字母本身. import java.util.*; import java.io.*; public class Ma ...
- Codeforces13C–Sequence(区间DP)
题目大意 给定一个含有N个数的序列,要求你对一些数减掉或者加上某个值,使得序列变为非递减的,问你加减的值的总和最少是多少? 题解 一个很显然的结果就是,变化后的每一个值肯定是等于原来序列的某个值,因为 ...
- (贪心5.1.2)POJ 2287 Tian Ji -- The Horse Racing
/* * POJ_2287.cpp * * Created on: 2013年10月9日 * Author: Administrator */ #include <iostream> #i ...