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

Fix .NET Native compilation #2170

Merged
merged 2 commits into from
Jan 4, 2021
Merged

Fix .NET Native compilation #2170

merged 2 commits into from
Jan 4, 2021

Conversation

nirinchev
Copy link
Member

@nirinchev nirinchev commented Jan 4, 2021

Description

Hopefully fixes #2169.

TODO

  • Changelog entry
  • Tests (if applicable)

@nirinchev nirinchev requested a review from fealebenpae January 4, 2021 17:29
Comment on lines -31 to -33
[FieldOffset(0)]
[MarshalAs(UnmanagedType.U1)]
private bool bool_value;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing the [MarshalAs] attribute from bool_value appears to fix the issue.

@@ -11,15 +11,14 @@
<AssemblyName>Tests.UWP</AssemblyName>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewers can ignore changes to this file - since we don't run UWP tests automatically, the project file had rotted a little and needed to bring it up to date to be able to debug things.

@@ -46,6 +46,9 @@ if(APPLE)
endif()
elseif(CMAKE_SYSTEM_NAME MATCHES "^Windows")
add_definitions(/DWIN32_LEAN_AND_MEAN)
add_compile_options(
/MP # Enable multi-processor compilation
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fealebenpae added this since it seemed like we didn't compile the wrapper sources in parallel.

Copy link
Member

@fealebenpae fealebenpae left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose this might be a legitimate bug in the MCG - after all in Win32 BOOL is usually 4 bytes, so maybe the marshaler hasn't been exercised with the more portable 1-byte bool? Whatever the reason, piggy-backing on int_value is a good workaround.

@nirinchev nirinchev merged commit 3ab5fb9 into master Jan 4, 2021
@nirinchev nirinchev deleted the ni/net-native branch January 4, 2021 23:33
@nirinchev nirinchev self-assigned this Jan 8, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Realm .NET 10.0.0-beta.3 crashes on UWP/iOS release build
2 participants