Skip to content

Make code NativeAOT compatible #1609

New issue

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

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

Already on GitHub? # to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kant2002
Copy link

I know that C# files are autogenerated, but in case
somebody what to use it without waiting for change in code gen tooling.
This PR has 3 changes, all of them trivially can be updated in the codegen:

  • Marshal.SizeOf(Type) switched to Marshal.SizeOf<T>()
  • Marshal.PtrToStructure(IntPtr, Type) to Marshal.PtrToStructure<T>(IntPtr)
  • Marshal.PtrToStructure<string>(IntPtr) is gross error, and should be mapped to Marshal.PtrToStringAnsi(IntPtr)

This and #707 should make life of C# developer, amenable and close #638 and #472.

I know that C# files are autogenerated, but in case
 somebody what to use it without waiting for change in code gen tooling.
 This PR has 3 changes, all of them trivially can be updated in the codegen:
 - `Marshal.SizeOf(Type)` switched to `Marshal.SizeOf<T>()`
 - `Marshal.PtrToStructure(IntPtr, Type)` to `Marshal.PtrToStructure<T>(IntPtr)`
 - `Marshal.PtrToStructure<string>(IntPtr)` is gross error, and should be mapped to `Marshal.PtrToStringAnsi(IntPtr)`
@SupinePandora43
Copy link

Marshal.PtrToStructure<T>(IntPtr) can be replaced by *((T*)IntPtr)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RenderModel_TextureMap_(packed_)t Incorrect data types in C#
2 participants