格式太旧或是类型库无效。 (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 ...
随机推荐
- 从修复 testerhome(rubychina)网站的一个 bug 学习 ruby&rails on ruby
前言 testerhome: http://testerhome.com/topics/1480 对于一个差点脱离前沿技术人,想要学习ruby,就意味着要放弃熟悉的操作系统windows,熟悉的ide ...
- bootstrap-内联表单 水平(横向)表单 响应式图片 辅助类 [转]
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8&quo ...
- Nhibernate Icreteria 分页查询
1.创建查询条件,条件为一个ICreterion的列表 /// /// 创建Criteria(不含order,因为获取总数的时候,为了性能考虑,不加order) /// ...
- 【原】Spark中Master源码分析(二)
继续上一篇的内容.上一篇的内容为: Spark中Master源码分析(一) http://www.cnblogs.com/yourarebest/p/5312965.html 4.receive方法, ...
- 2015年9月28日html基础了解学习
数据库与C#都是在后台运行的逻辑,而html,css,js,jq是在网页前台显示的一些效果.后台要考虑到优化性能效率等等,而前台要吸引到客户,要有更好的客户体验. 通用化,还是效率更高,在做项目中是要 ...
- VS2013 MVC Web项目使用内置的IISExpress支持局域网内部机器(手机、PC)访问、调试
VS2013内置了IISExpress.做asp.net MVC的web项目开发时,Ctrl+F5和F5启动项目运行(后者是调试模式)的同时都会打开IISExpress,事实上本机对该web项目走的就 ...
- Phonegap3.4 环境搭建及新建项目
一.环境准备 1.到这里安装Node.js. 2.到这里下载Adroid ADT Bundle for Windows,下载后解压,我的放在:F:\MobileDev\adt-bundle-windo ...
- 【JS】Beginner3 & 4 & 5 & 6:Maths & Logic & Conditonal & Looping
1.number operator () * / + - 2.logic make decisions in code compare values to produce a boolean valu ...
- Java 并发之共享对象
上一篇文章说的是,避免多个线程在同一时间访问对象中的同一数据,这篇文章来详细说说共享和发布对象. 在没有同步的情况下,我们无法预料编译器.处理器安排操作执行的顺序,经常会发生以为“一定会”发生的动作实 ...
- Zabbix lld发现磁盘监控
一.软件版本 操作系统:CentOS-6.5-x86_64 zabbix版本:3.0.3 二.脚本编写: 1.python版本: #!/usr/bin/env python import json i ...