Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -229,34 +229,28 @@ file unsafe partial interface InterfaceImplementation
[System.Runtime.InteropServices.UnmanagedCallersOnlyAttribute(CallConvs = new[] { typeof(System.Runtime.CompilerServices.CallConvMemberFunction) })]
internal static int ABI_Method(System.Runtime.InteropServices.ComWrappers.ComInterfaceDispatch* __this_native, nint __param_native)
{
bool __invokeSucceeded = default;
global::SharedTypes.ComInterfaces.IStatefulFinallyMarshalling @this = default;
global::SharedTypes.ComInterfaces.StatefulFinallyType param = default;
int __retVal = default;
// Setup - Perform required setup.
global::SharedTypes.ComInterfaces.StatefulFinallyTypeMarshaller __param_native__marshaller = new();
try
{
// GuaranteedUnmarshal - Convert native data to managed data even in the case of an exception during the non-cleanup phases.
param = __param_native__marshaller.ToManagedFinally();
// UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
__param_native__marshaller.FromUnmanaged(__param_native);
// Unmarshal - Convert native data to managed data.
__retVal = 0; // S_OK
@this = System.Runtime.InteropServices.ComWrappers.ComInterfaceDispatch.GetInstance<global::SharedTypes.ComInterfaces.IStatefulFinallyMarshalling>(__this_native);
@this.Method(param);
__invokeSucceeded = true;
}
catch (System.Exception __exception)
{
__retVal = System.Runtime.InteropServices.Marshalling.ExceptionAsHResultMarshaller<int>.ConvertToUnmanaged(__exception);
}
finally
{
if (__invokeSucceeded)
{
// GuaranteedUnmarshal - Convert native data to managed data even in the case of an exception during the non-cleanup phases.
param = __param_native__marshaller.ToManagedFinally();
}

// Cleanup - Perform required cleanup.
__param_native__marshaller.Free();
}
Expand All @@ -267,7 +261,6 @@ internal static int ABI_Method(System.Runtime.InteropServices.ComWrappers.ComInt
[System.Runtime.InteropServices.UnmanagedCallersOnlyAttribute(CallConvs = new[] { typeof(System.Runtime.CompilerServices.CallConvMemberFunction) })]
internal static int ABI_MethodIn(System.Runtime.InteropServices.ComWrappers.ComInterfaceDispatch* __this_native, nint* __param_native__param)
{
bool __invokeSucceeded = default;
global::SharedTypes.ComInterfaces.IStatefulFinallyMarshalling @this = default;
ref nint __param_native = ref *__param_native__param;
global::SharedTypes.ComInterfaces.StatefulFinallyType param = default;
Expand All @@ -276,26 +269,21 @@ internal static int ABI_MethodIn(System.Runtime.InteropServices.ComWrappers.ComI
global::SharedTypes.ComInterfaces.StatefulFinallyTypeMarshaller __param_native__marshaller = new();
try
{
// GuaranteedUnmarshal - Convert native data to managed data even in the case of an exception during the non-cleanup phases.
param = __param_native__marshaller.ToManagedFinally();
// UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
__param_native__marshaller.FromUnmanaged(__param_native);
// Unmarshal - Convert native data to managed data.
__retVal = 0; // S_OK
@this = System.Runtime.InteropServices.ComWrappers.ComInterfaceDispatch.GetInstance<global::SharedTypes.ComInterfaces.IStatefulFinallyMarshalling>(__this_native);
@this.MethodIn(in param);
__invokeSucceeded = true;
}
catch (System.Exception __exception)
{
__retVal = System.Runtime.InteropServices.Marshalling.ExceptionAsHResultMarshaller<int>.ConvertToUnmanaged(__exception);
}
finally
{
if (__invokeSucceeded)
{
// GuaranteedUnmarshal - Convert native data to managed data even in the case of an exception during the non-cleanup phases.
param = __param_native__marshaller.ToManagedFinally();
}

// Cleanup - Perform required cleanup.
__param_native__marshaller.Free();
}
Expand Down Expand Up @@ -339,7 +327,6 @@ internal static int ABI_MethodOut(System.Runtime.InteropServices.ComWrappers.Com
[System.Runtime.InteropServices.UnmanagedCallersOnlyAttribute(CallConvs = new[] { typeof(System.Runtime.CompilerServices.CallConvMemberFunction) })]
internal static int ABI_MethodRef(System.Runtime.InteropServices.ComWrappers.ComInterfaceDispatch* __this_native, nint* __param_native__param)
{
bool __invokeSucceeded = default;
global::SharedTypes.ComInterfaces.IStatefulFinallyMarshalling @this = default;
ref nint __param_native = ref *__param_native__param;
global::SharedTypes.ComInterfaces.StatefulFinallyType param = default;
Expand All @@ -348,13 +335,14 @@ internal static int ABI_MethodRef(System.Runtime.InteropServices.ComWrappers.Com
global::SharedTypes.ComInterfaces.StatefulFinallyTypeMarshaller __param_native__marshaller = new();
try
{
// GuaranteedUnmarshal - Convert native data to managed data even in the case of an exception during the non-cleanup phases.
param = __param_native__marshaller.ToManagedFinally();
// UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
__param_native__marshaller.FromUnmanaged(__param_native);
// Unmarshal - Convert native data to managed data.
__retVal = 0; // S_OK
@this = System.Runtime.InteropServices.ComWrappers.ComInterfaceDispatch.GetInstance<global::SharedTypes.ComInterfaces.IStatefulFinallyMarshalling>(__this_native);
@this.MethodRef(ref param);
__invokeSucceeded = true;
// PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
__param_native = __param_native__marshaller.ToUnmanaged();
// Marshal - Convert managed data to native data.
Expand All @@ -366,12 +354,6 @@ internal static int ABI_MethodRef(System.Runtime.InteropServices.ComWrappers.Com
}
finally
{
if (__invokeSucceeded)
{
// GuaranteedUnmarshal - Convert native data to managed data even in the case of an exception during the non-cleanup phases.
param = __param_native__marshaller.ToManagedFinally();
}

// Cleanup - Perform required cleanup.
__param_native__marshaller.Free();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,62 +203,46 @@ file unsafe partial interface InterfaceImplementation
[System.Runtime.InteropServices.UnmanagedCallersOnlyAttribute(CallConvs = new[] { typeof(System.Runtime.CompilerServices.CallConvMemberFunction) })]
internal static int ABI_Method(System.Runtime.InteropServices.ComWrappers.ComInterfaceDispatch* __this_native, nint __param_native, int size)
{
bool __invokeSucceeded = default;
global::SharedTypes.ComInterfaces.IStatelessFinallyMarshalling @this = default;
global::SharedTypes.ComInterfaces.StatelessFinallyType param = default;
int __retVal = default;
try
{
// GuaranteedUnmarshal - Convert native data to managed data even in the case of an exception during the non-cleanup phases.
param = global::SharedTypes.ComInterfaces.StatelessFinallyTypeMarshaller.ConvertToManagedFinally(__param_native);
// Unmarshal - Convert native data to managed data.
__retVal = 0; // S_OK
@this = System.Runtime.InteropServices.ComWrappers.ComInterfaceDispatch.GetInstance<global::SharedTypes.ComInterfaces.IStatelessFinallyMarshalling>(__this_native);
@this.Method(param, size);
__invokeSucceeded = true;
}
catch (System.Exception __exception)
{
__retVal = System.Runtime.InteropServices.Marshalling.ExceptionAsHResultMarshaller<int>.ConvertToUnmanaged(__exception);
}
finally
{
if (__invokeSucceeded)
{
// GuaranteedUnmarshal - Convert native data to managed data even in the case of an exception during the non-cleanup phases.
param = global::SharedTypes.ComInterfaces.StatelessFinallyTypeMarshaller.ConvertToManagedFinally(__param_native);
}
}

return __retVal;
}

[System.Runtime.InteropServices.UnmanagedCallersOnlyAttribute(CallConvs = new[] { typeof(System.Runtime.CompilerServices.CallConvMemberFunction) })]
internal static int ABI_MethodIn(System.Runtime.InteropServices.ComWrappers.ComInterfaceDispatch* __this_native, nint* __param_native__param, int size)
{
bool __invokeSucceeded = default;
global::SharedTypes.ComInterfaces.IStatelessFinallyMarshalling @this = default;
ref nint __param_native = ref *__param_native__param;
global::SharedTypes.ComInterfaces.StatelessFinallyType param = default;
int __retVal = default;
try
{
// GuaranteedUnmarshal - Convert native data to managed data even in the case of an exception during the non-cleanup phases.
param = global::SharedTypes.ComInterfaces.StatelessFinallyTypeMarshaller.ConvertToManagedFinally(__param_native);
// Unmarshal - Convert native data to managed data.
__retVal = 0; // S_OK
@this = System.Runtime.InteropServices.ComWrappers.ComInterfaceDispatch.GetInstance<global::SharedTypes.ComInterfaces.IStatelessFinallyMarshalling>(__this_native);
@this.MethodIn(in param, size);
__invokeSucceeded = true;
}
catch (System.Exception __exception)
{
__retVal = System.Runtime.InteropServices.Marshalling.ExceptionAsHResultMarshaller<int>.ConvertToUnmanaged(__exception);
}
finally
{
if (__invokeSucceeded)
{
// GuaranteedUnmarshal - Convert native data to managed data even in the case of an exception during the non-cleanup phases.
param = global::SharedTypes.ComInterfaces.StatelessFinallyTypeMarshaller.ConvertToManagedFinally(__param_native);
}
}

return __retVal;
}
Expand Down Expand Up @@ -290,7 +274,6 @@ internal static int ABI_MethodOut(System.Runtime.InteropServices.ComWrappers.Com
[System.Runtime.InteropServices.UnmanagedCallersOnlyAttribute(CallConvs = new[] { typeof(System.Runtime.CompilerServices.CallConvMemberFunction) })]
internal static int ABI_MethodRef(System.Runtime.InteropServices.ComWrappers.ComInterfaceDispatch* __this_native, nint* __param_native__param, int size)
{
bool __invokeSucceeded = default;
global::SharedTypes.ComInterfaces.IStatelessFinallyMarshalling @this = default;
ref nint __param_native = ref *__param_native__param;
global::SharedTypes.ComInterfaces.StatelessFinallyType param = default;
Expand All @@ -300,11 +283,12 @@ internal static int ABI_MethodRef(System.Runtime.InteropServices.ComWrappers.Com
nint __param_native__original = __param_native;
try
{
// GuaranteedUnmarshal - Convert native data to managed data even in the case of an exception during the non-cleanup phases.
param = global::SharedTypes.ComInterfaces.StatelessFinallyTypeMarshaller.ConvertToManagedFinally(__param_native);
// Unmarshal - Convert native data to managed data.
__retVal = 0; // S_OK
@this = System.Runtime.InteropServices.ComWrappers.ComInterfaceDispatch.GetInstance<global::SharedTypes.ComInterfaces.IStatelessFinallyMarshalling>(__this_native);
@this.MethodRef(ref param, size);
__invokeSucceeded = true;
// Marshal - Convert managed data to native data.
__param_native = global::SharedTypes.ComInterfaces.StatelessFinallyTypeMarshaller.ConvertToUnmanaged(param);
__param_native__ownOriginal = true;
Expand All @@ -315,12 +299,6 @@ internal static int ABI_MethodRef(System.Runtime.InteropServices.ComWrappers.Com
}
finally
{
if (__invokeSucceeded)
{
// GuaranteedUnmarshal - Convert native data to managed data even in the case of an exception during the non-cleanup phases.
param = global::SharedTypes.ComInterfaces.StatelessFinallyTypeMarshaller.ConvertToManagedFinally(__param_native);
}

// Cleanup - Perform required cleanup.
if (__param_native__ownOriginal)
{
Expand Down