Add support for JsonStringEnumMemberName and X509CertificateLoader for .net10#651
Conversation
…improved type handling, and JsonStringEnumMemberName attribute.
|
@dotnet-policy-service agree company="maib" |
|
I think this is in the right direction, however we don't solve for the COSE serialisation as mentioned in this comment: #645 (comment) But that doesn't necessarily need to block this PR and could be done in a follow up PR. Not sure if everyone impacted by this problem is also impacted by that problem. |
|
In our case the only problem was enum string value, so i hope it will fix at least this one |
abergs
left a comment
There was a problem hiding this comment.
Thanks for working on this, much appreciated. Left some comments and pushed a small cleanup.
|
@iamcarbon You know your way around jsonmember serialisation better than I do. Any other comments here? I'm thinking we only drop .net8 in november, so this would be a nice stop gap solution for people already on .net 10. |
|
Hmm, did i broke something in tests? |
|
Consider using an internal Polyfill for JsonStringEnumMemberName to avoid churn (which we can delete when removing the .NET9 target). If we only use this in Models, we could also just delete EnumMember then. |
|
Consider also dedupping the logic for certification loading into a helper. |
|
The unrelated changes in Tpm should also be proposed in a separate PR, so this remains scoped to supporting .NET10 |
|
looks like all comments are resolved |
|
fixed last tests. i hope |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #651 +/- ##
==========================================
- Coverage 78.62% 78.61% -0.01%
==========================================
Files 98 98
Lines 2545 2544 -1
Branches 423 425 +2
==========================================
- Hits 2001 2000 -1
Misses 434 434
Partials 110 110 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@vpetrusevici Seems MacOS tests are still failing. |
|
Sorry. I don't see anything in the changes yet that could affect this. It's probably some kind of incompatibility with .NET 10. Could you help me please? @abergs |
|
@vpetrusevici Alright so I've done some analysis and I can see what's going wrong. In your PR, you change how the apple tests load certificates in I think perhaps we should remove the try/catch from the wrapper as it doesn't add much value? I think (I haven't verified) that all callers are internal. We would maybe in some situation expose the CryptographicException to callers, but I don't think that is necessarily bad. edit: If we want to be a bit more surgical (but it adds complexity) we catch and rethrow CryptographicException. Not sure if there are any other exceptions that could be thrown though. |
|
Thanks! I also think that we should see the real exception for such cases |
…rtificate loading
|
Removed try catch. fixed one test for this exception |
|
@vpetrusevici Unfortunately tests still seem to be failing on both mac and linux. |
|
Ok, i see. I added unnecessary assert, it has different exception on each platform... |
|
@abergs try again please |
|
All checks look good, let's merge this :) Thank you for all the follow up. |
|
I've released 5.0.0-preview.1 from main with this fix. |
Summary
Adds compatibility updates for .NET 10+, including conditional attributes, improved type handling, and support for JsonStringEnumMemberName.
Details
Notes
To enable this support and prevent runtime issues, usage of X509CertificateLoader was also introduced.
Some minor changes in tests too.