Skip to content

Activator.CreateInstance fails on GetTypeFromProgID on .NET Core 3.1 #37362

Closed
@JeremyKuhne

Description

@JeremyKuhne

Copied from @199621616 's comment: dotnet/winforms#1878 (comment)
cc: @AaronRobinsonMSFT

示例一:医疗保险系统对接的COM互操作:
保险系统接口规范提供PB调用示例:

//创建地纬嵌入式接口对象,调用com组件
int vi Oleobject sei                                 
sei =create Oleobject     //创建ole对象seiproxy
vi= sei.connecttonewobject('sei3') //连接com组件 if vi <> 0 then    
messagebox('错误','创建地纬嵌入式接口sei对象失败!')    
return end if

我们使用.NetFramework4.6.1调用方式:
Type type = Type.GetTypeFromProgID("sei3", true);
dynamic COM = Activator.CreateInstance(type);

使用同样的方式,在.NetCore3.1.4上运行返回异常:
Creating an instance of the COM component with CLSID {D5D8D5B2-CCD5-4EEC-BE61-0CA13A1940C7} from the IClassFactory failed due to the following error: ffffdf8f 0xFFFFDF8F.


Example 1: com interoperability of medical insurance system docking:

The insurance system interface specification provides Pb call examples:

//Create the ground latitude embedded interface object and call COM component

int vi Oleobject sei                                 

SEI = create oleobject / / create OLE object seiproxy

vi= sei.connecttonewobject ('sei3 ') / / connect COM component if VI < > 0 then

MessageBox ('error ',' failed to create SEI object of ground latitude embedded interface! ')    

return end if

We use. Netframework 4.6.1 to call:

Type type = Type.GetTypeFromProgID ("sei3", true);

dynamic COM = Activator.CreateInstance (type);

Using the same method, run return exception on. NETCORE 3.1.4:

Creating an instance of the COM component with CLSID {D5D8D5B2-CCD5-4EEC-BE61-0CA13A1940C7} from the IClassFactory failed due to the following error: ffffdf8f 0xFFFFDF8F.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions