Skip to content

Revert use of raw pointers in System.Text.Json (#78741)" - #84899

Merged
jkotas merged 1 commit into
dotnet:mainfrom
jkotas:jsonfix
Apr 17, 2023
Merged

jkotas merged 1 commit into
dotnet:mainfrom
jkotas:jsonfix

Conversation

@jkotas

@jkotas jkotas commented Apr 16, 2023

Copy link
Copy Markdown
Member

Revert use of raw pointers for .NET Standard support. This particular raw pointer use does not work with .NET UWP toolchain.

Also, convert uses of Enum.HasFlags to simple bit tests for better .NET Framework and .NET Standard support. Enum.HasFlags performs poorly (boxes) on .NET Framework and .NET Standard targets.

Fixes #84895

Revert use of raw pointers for .NET Standard support. This particular raw pointer use does not work with .NET UWP toolchain.

Also, convert uses of Enum.HasFlags to simple bit tests for better .NET Framework and .NET Standard support. Enum.HasFlags performs poorly (boxes) on .NET Framework and .NET Standard targets.

Fixes dotnet#84895
@ghost ghost assigned jkotas Apr 16, 2023
@ghost

ghost commented Apr 16, 2023

Copy link
Copy Markdown

Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis
See info in area-owners.md if you want to be subscribed.

Issue Details

Revert use of raw pointers for .NET Standard support. This particular raw pointer use does not work with .NET UWP toolchain.

Also, convert uses of Enum.HasFlags to simple bit tests for better .NET Framework and .NET Standard support. Enum.HasFlags performs poorly (boxes) on .NET Framework and .NET Standard targets.

Fixes #84895

Author: jkotas
Assignees: -
Labels:

area-System.Text.Json

Milestone: -

@Sergio0694

Sergio0694 commented Apr 16, 2023 •

Copy link
Copy Markdown
Contributor

Is there a way to try out OOB packages from an open PR? I'd like to double check that the Store can build fine with these changes to validate that this does in fact fix the issue, and that there aren't other places where this might've caused issues 🤔

Does the .NET CI push NuGet packages from PRs into some preview feed maybe, or something like that?

EDIT: I guess it's not needed, we know for sure those two methods were an issue so might as well fix them and then I can double check after that. If anything else does pop up (hopefully not), I can just open a separate issue to track that 🙂

@Sergio0694 Sergio0694 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, thank you!! 🙌

@jkotas

jkotas commented Apr 16, 2023

Copy link
Copy Markdown
Member Author

@Sergio0694 It would be great if you can validate the fix.

PRs do not publish packages to any feeds. Can you build it locally? I think it is the easiest way to do it.

@Sergio0694

Copy link
Copy Markdown
Contributor

Yup I can try that! Will report back 👍

@Sergio0694

Copy link
Copy Markdown
Contributor

It seems to work!! 🎉
I could build the Store with .NET Native locally and I can confirm I'm no longer getting that AV in the NUTC driver.


For future reference, I created a package like this:

./build.cmd clr+libs -c Release;
cd src\libraries\System.Text.Json\src;
dotnet pack

The package was then created in \artifacts\packages\Release\Shipping.

@jkotas
jkotas merged commit 0099ffa into dotnet:main Apr 17, 2023
@jkotas
jkotas deleted the jsonfix branch April 17, 2023 01:05
@ghost ghost locked as resolved and limited conversation to collaborators May 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

System.Text.Json fails to build on .NET Native due to unconstrained raw pointer uses

3 participants