WhiteFalcon
Sharing the custom marshalled type across libraries
I followed the guide thoroughly https://learn.microsoft.com/en-us/dotnet/standard/native-interop/tutorial-custom-marshaller and source code is in here https://github.com/dotnet/samples/blob/main/core/interop/source-generation/custom-marshalling/src/custommarshalling/NativeLib.cs
so far it works, but things goes south when i try to use the
ErrorData
outside of host library
code used to test it out:
PS: unlike the original source code, i've made modification to ErrorData and their marshallers by making everything public just for testing.
it generates SYSLIB1051 error error SYSLIB1051: Runtime marshalling must be disabled in this project by applying the 'System.Runtime.CompilerServices.DisableRuntimeMarshallingAttribute' to the assembly to enable marshalling this type. The generated source will not handle marshalling of parameter 'errorData'. (https://learn.microsoft.com/dotnet/fundamentals/syslib-diagnostics/syslib1051)
6 replies