错误提示信息

格式太旧或是类型库无效。 (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:

  1. To change your thread localization (by code)
  2. 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))的更多相关文章

  1. "格式太旧或是类型库无效。 (异常来自 HRESULT:0x80028019 (TYPE_E_UNSUPFORMAT))"

    错误提示内容: “System.Runtime.InteropServices.COMException (0x80028019): 格式太旧或是类型库无效. (异常来自 HRESULT:0x8002 ...

  2. 错误信息:内存位置访问无效。 (Exception from HRESULT: 0x800703E6)

    错误提示: 错误信息:内存位置访问无效. (Exception from HRESULT: 0x800703E6) 异常类型:System.BadImageFormatException 堆栈跟踪: ...

  3. Delphi COM编程技术三类型库(库文件中的工具栏,很全)

    在COM组件的使用和开发过程中经常需要获取有关组件的信息.而COM组件以二进制代码的形式发布,如果不借助特定的工具这些相关信息将难以被获取.通过访问类型库就可以查看COM组件的信息. 一.类型库的基础 ...

  4. [转]如何使用MFC和类型库创建自动化项目

    本文转自:http://www.cnblogs.com/zhoug2020/archive/2012/04/01/2429064.html 摘要 本文详细介绍了如何自动化像Microsoft Offi ...

  5. 不同格式图片相互转换的开源库分享(使用CxImage,并有VC6的配置过程)

    不同格式图片相互转换的开源库分享 一.背景 笔者在项目的开发中,需要调用windows下的COM接口SetIconLocation来实现桌面快捷方式.而我们项目中给定的图片格式为png格式,SetIc ...

  6. 试图加载格式不正确的程序。 (Exception from HRESULT: 0x8007000B)

    原文:试图加载格式不正确的程序. (Exception from HRESULT: 0x8007000B) 今天在电脑上部署公司的项目,出现这个错误.Bing后,找到原来是因为项目是32位的,而我的系 ...

  7. net 试图加载格式不正确的程序。(Exception from HRESULT: 0x8007000B)

    原文:net 试图加载格式不正确的程序.(Exception from HRESULT: 0x8007000B) Server Error in '/' Application. 试图加载格式不正确的 ...

  8. 解决 “MoveFile”: 类型库“XXX.dll”中的标识符已经是宏;使用“rename”限定符 类型库符号与系统符号冲突问题

    今天在VS工程当中引入一个组件,编译的时候出现警告, “MoveFile”: 类型库“XXX.dll”中的标识符已经是宏:使用“rename”限定符.虽然只是一个警告,但看着实在不爽,更重要的是,警告 ...

  9. 获取COM组件类型库信息

    类型库type library的作用是什么? 用来描述这个COM组建的接口信息,比如有多少个接口,每个接口有什么函数,函数的描述之类的.MSDN查一下ITypeLib,ITypeInfo,TypeAt ...

随机推荐

  1. BZOJ2818: Gcd 欧拉函数求前缀和

    给定整数N,求1<=x,y<=N且Gcd(x,y)为素数的数对(x,y)有多少对. 如果两个数的x,y最大公约数是z,那么x/z,y/z一定是互质的 然后找到所有的素数,然后用欧拉函数求一 ...

  2. web_reg_find()查询信息为变量

    Action(){char *str1;//=(char*)malloc(20);char str2[10]; web_url("toLoginPage", "URL={ ...

  3. 【原】Spark on YARN

    在YARN上运行Spark 在Spark0.6.0版本开始支持YARN模式,随后的版本在逐渐地完善. 在YARN上启动Spark 确保HADOOP_CONF_DIR或YARN_CONF_DIR属性的值 ...

  4. 类加载器classCloader

    ref: http://blog.csdn.net/studyvcmfc/article/details/7720322 得复习一下深入java虚拟机 1.类加载器干啥的? 把 class文件加载到虚 ...

  5. vijosP1543 极值问题

    vijosP1543 极值问题 链接:https://vijos.org/p/1543 [题解](网上) 从简单情况人手:     设定m=1,将m代人方程②有(n2-n-1)2=1,可求出n=1: ...

  6. hadoop部署小结的命令

    hadoop部署总结的命令 学习笔记,转自:hadoop部署总结的命令http://www.aboutyun.com/thread-5385-1-1.html(出处: about云开发)

  7. Xcode部分插件无法使用识别的问题

    1. 首先查看 Xcode 的 UUID,在终端执行 defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilit ...

  8. ural 1091. Tmutarakan Exams 和 codeforces 295 B. Greg and Graph

    ural 1091 题目链接:http://acm.timus.ru/problem.aspx?space=1&num=1091 题意是从1到n的集合里选出k个数,使得这些数满足gcd大于1 ...

  9. java动态编程库,利用动态编程打印运行时调用全景(函数调用关系链)

    如果是一般java程序,不追求性能极致,想使用方便,推荐使用 Javassist 库. 如果是android程序,或者一般java程序欲追求性能极限,推荐使用 asm for java 及 asmde ...

  10. 在C#中生成唯一的字符串和数字【GUID】转

    转自:http://www.cnblogs.com/lcwzj/archive/2009/04/16/1436992.html 当我们想要获得一个唯一的key的时候,通常会想到GUID.这个key非常 ...