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

On .Net 6, the System.Json.Text serializer now seems to choke on the return value in the MakeAssertion function. #328

Closed
abergs opened this issue Sep 29, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@abergs
Copy link
Collaborator

abergs commented Sep 29, 2022

It throws this exception:
"Serialization and deserialization of 'System.IntPtr' instances are not supported. Path: $.Result.AttestationCertificate.Handle."

The problem can also be recreated in your current master branch if you register a new credential in the demo app under Custom with Direct attestation

Originally posted in #305 #305 (comment)

@abergs abergs added the bug Something isn't working label Sep 29, 2022
@abergs
Copy link
Collaborator Author

abergs commented Sep 29, 2022

The root problem is quite self explanatory. System.Json.Text does not support serialization of System.IntPtr.

The CredentialMakeResult contains a X509Certificate2 which contains the System.IntPtr as the Handle property.

There are many ways to solve this problems:

  1. Not serialize the X509Certificate2 (e.g. setting AttestationCertificate it to null, before serialization)
  2. Convert the entire Result object to a custom DTO that has the properties to are interested in
  3. Use a custom converter

Thanks for the report. I have fixed the problem in our Demo site. @m-gug

@abergs abergs closed this as completed Sep 29, 2022
abergs added a commit that referenced this issue Sep 29, 2022
abergs added a commit that referenced this issue Sep 29, 2022
@dIeGoLi
Copy link
Contributor

dIeGoLi commented Dec 8, 2022

Maybe it would make sense to add [JsonIgnore] attribute this property. That way we do not have to set the property to null manually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants