Windows error 0x80131533, -2146233037

Detailed Error Information

COR_E_SAFEARRAYTYPEMISMATCH[1]

Message"A mismatch has occurred between the runtime type of the array and the sub type recorded in the metadata."
Comment A mismatch has occurred between the runtime type of the array and the subtype recorded in the metadata

HRESULT analysis[2]

FlagsSeverityFailure
Reserved (R)false
OriginMicrosoft
NTSTATUSfalse
Reserved (X)false
FacilityCode19 (0x013)
NameFACILITY_URT[2][3]
DescriptionThe source of the error code is .NET CLR.[2][3]
Error Code5427 (0x1533)

Questions

3votes
1answer

How to pass data to C# COM DLL from unmanaged application

ะก# COM DLL Interface: public interface IShowDialog { void showMessage(byte[] array); } and call it in unmanaged C++ application: SAFEARRAY *array; array = SafeArrayCreateVector(VT_BSTR, 0, 1); long lidx = 0; SafeArrayPutElement( array, &lidx, SysAllocString(L"test") ); hr = dlg->showMessage(array); Result: 0x80131533 - COR_E_SAFEARRAYTYPEMISMATCH read more
c#
c++
dll
com
2votes
1answer

How to marshal array of bools in C++ to an array of bool in C#

I have the following COM visible property in a C# class: [ComVisible] bool[] Values; I have an instance of the class in C++ and used the following code to set this property (only pseudocode) CComSafeArray<VARIANT_BOOL> values(3); values[0] = VARIANT_FALSE; values[1] = VARIANT_FALSE; HRESULT hr = instance->put_Values(values.Detach()); The last line of [...] read more
c#
.net
com
com-interop
1vote
1answer

SAFEARRAY of COM objects

I'm using COM library and I have interface defined in .tlh file as following: _COM_SMARTPTR_TYPEDEF(IMyInterface, __uuidof(IMyInterface)); Then I create object: //1st object IMyInterfacePtr pMyInterface1; pMyInterface1.CreateInstance(CLSID_MyInterface); pMyInterface1->call_some_method(BSTR("pass example text1")); //2nd object IMyInterfacePtr pMyInterface2; pMyInterface2.CreateInstance(CLSID_MyInterface); pMyInterface2->call_some_method(BSTR("pass example text2")); Then I need to create SAFEARRAY of these objects: SAFEARRAYBOUND rgsabound[1]; rgsabound[0].cElements = 2; [...] read more
c++
com
safearray
0votes
1answer

_AppDomainPtr Load_3 method example?

I am trying to load a C# assembly with _AppDomainPtr Load_3 method. Do you have some example since I get error: hr = 0x80131533 : A mismatch has occurred between the runtime type of the array and the sub type recorded in the metadata. Here is a snippet how do [...] read more
c#
c++
winapi
clr
appdomain
-1votes
1answer

Invoke .NET method via COM, with a ref array

I have a .NET DLL that exposes a method that looks like this in C#: void TestMethod(ref TestClass[] parameter) Where TestClass is a regular C# class that has a COM-visible interface, and I'm supposed to call the method with an array with one element. I can't figure out how to [...] read more
c#
c++
com

Comments

Leave a comment

(plain text only)

Sources

  1. https://github.com/dotnet/coreclr/blob/v1.1.0/src/inc/corerror.xml
  2. https://msdn.microsoft.com/en-us/library/cc231198.aspx
  3. winerror.h from Windows SDK 10.0.14393.0

User contributions licensed under CC BY-SA 3.0