Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NativeAOT] Missing Marshal.PtrToStructure on some types #240

Closed
mrhelmut opened this issue Oct 17, 2020 · 2 comments
Closed

[NativeAOT] Missing Marshal.PtrToStructure on some types #240

mrhelmut opened this issue Oct 17, 2020 · 2 comments
Labels
area-NativeAOT-coreclr .NET runtime optimized for ahead of time compilation

Comments

@mrhelmut
Copy link

Hello there,

While implementing an SDK from a third party vendor (which is a C# wrapper to a native C dll), we stumbled upon some issues with Marshal.PtrToStructure() and StructureToPtr() which are throwing exceptions.

The exceptions go as "marshalling from this type is currently not supported".

The type goes like this:

	[StructLayout(LayoutKind.Sequential, Pack = 8)]
	internal sealed class SomeClass
	{
		public object SomeField { get; private set; }

		public SomeClass(object someField )
		{
			SomeField = someField ;
		}
	}

The context is in regard to marshalling this type to IntPtr back and forth.

Given the nature of the exception, I am assuming that it is known and scheduled to be implemented at some point. If so, please do feel free to consider this as a non-issue.

On our end we've been able to workaround this with the vendor by reworking the wrapper to work differently on marshalling these data.

Cheers!

@jkotas jkotas added the area-NativeAOT-coreclr .NET runtime optimized for ahead of time compilation label Oct 17, 2020
@MichalStrehovsky
Copy link
Member

I think the object field implies COM marshalling - that's a tough one and one of dotnet/runtime#69919.

There were many discussions about COM support in the CoreRT repo.

@MichalStrehovsky
Copy link
Member

Lets track this as part of general COM support in dotnet/runtime#69919.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-NativeAOT-coreclr .NET runtime optimized for ahead of time compilation
Projects
None yet
Development

No branches or pull requests

3 participants