Pass Parameter from asp.net core C# to vb6 dll type variant

Oct 15 2022 5:18 PM

I try to call vb6 dll from .NET CORE C#.

The Function VB6 is :

Public Function A_Select_Campione(rst As ADODB.Recordset, _
                              ByVal NomeTabella As String, _
                              ByVal StringaVariabiliCampione As String, _
                              ByRef TabellaCondizioni() As Variant, _
                              Optional ByVal StringaVariabiliSort As String, _
                              Optional ByRef Status As String, _
                              Optional IndirizzoSaveInXml As String, _
                              Optional cnn_Client As Variant) As Boolean

Call C# is:

        status = civ.A_Select_Campione(rs, "Operatori", "*",ref Tab);

where Tab i try define like System.array, List, Array but every time i have this error:

System.Runtime.InteropServices.SafeArrayTypeMismatchException
  HResult=0x80131533
  Messaggio=Specified array was not of the expected type.
  Origine=System.Private.CoreLib
  Analisi dello stack:
   in System.StubHelpers.MngdSafeArrayMarshaler.ConvertSpaceToNative(IntPtr pMarshalState, Object& pManagedHome, IntPtr pNativeHome)
   in InvCiv._clsIC.A_Select_Campione(Recordset& rst, String NomeTabella, String StringaVariabiliCampione, Array& TabellaCondizioni, String StringaVariabiliSort, String& Status, String& IndirizzoSaveInXml, Object& cnn_Client)
   in ASPBlazor.Pages.Counter.IncrementCount() in C:\Sviluppo\TestC\TestAspCore\ASPBlazor\Pages\Counter.razor: riga 69
   in Microsoft.AspNetCore.Components.EventCallbackWorkItem.InvokeAsync[T](MulticastDelegate delegate, T arg)
   in Microsoft.AspNetCore.Components.ComponentBase.Microsoft.AspNetCore.Components.IHandleEvent.HandleEventAsync(EventCallbackWorkItem callback, Object arg)
   in Microsoft.AspNetCore.Components.RenderTree.Renderer.DispatchEventAsync(UInt64 eventHandlerId, EventFieldInfo fieldInfo, EventArgs eventArgs)

How i define Tab in C# ?


Answers (2)