Skip to content

Conversation

ericstj
Copy link
Member

@ericstj ericstj commented Jul 15, 2025

Repo area owners:

@ericstj ericstj requested a review from tarekgh July 15, 2025 20:40
@tarekgh
Copy link
Member

tarekgh commented Jul 15, 2025

We may think in improving the tool formatting as I am seeing it is mis-indent some lines especially with const like public const System.Formats.Cbor.CborConformanceMode Canonical = 2; and other patterns like properties has new or required keyword on it.

@tarekgh tarekgh merged commit f023a1b into dotnet:main Jul 16, 2025
3 checks passed
@OwnageIsMagic
Copy link

@tarekgh CborConformanceMode is an enum. Seems like tool is able to handle enums, but only if it is already existed.

@tarekgh
Copy link
Member

tarekgh commented Jul 20, 2025

Thanks @OwnageIsMagic for the catch.

@ericstj It looks like we need to fix this issue in the tool. The enum isn’t new, yet the tool is generating it as a class. It seems the entire System.Formats.Cbor code being generated shouldn't be there at all.

Here is an example:
https://github.com/dotnet/runtime/blob/38192e3cbd5610c9fa3d814506424ad93dfa19b2/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborConformanceLevel.cs#L14

+ namespace System.Formats.Cbor
+ {
+     public sealed class CborConformanceMode
+     {
+ public const System.Formats.Cbor.CborConformanceMode Canonical = 2;
+         public const System.Formats.Cbor.CborConformanceMode Ctap2Canonical = 3;
+         public const System.Formats.Cbor.CborConformanceMode Lax = 0;
+         public const System.Formats.Cbor.CborConformanceMode Strict = 1;
+         public int value__;
+     }
+ }

@ericstj
Copy link
Member Author

ericstj commented Jul 21, 2025

That's a bizarre bug - the enum hasn't been touched for some time.
https://github.com/dotnet/runtime/blame/3eac7ee1b21c1c205a8a13828a4f0883f1e5f56b/src/libraries/System.Formats.Cbor/ref/System.Formats.Cbor.cs#L9-L15

What changed was the System.Formats.Cbor assembly was added to ASP.NET. This sort of bug occurs when the core assembly is not resolvable for key types like System.Enum, object, etc. GenAPI will just guess.

I think I see where the bug is, I'll put up a PR.

@ericstj
Copy link
Member Author

ericstj commented Jul 21, 2025

I opened #9988 - thank you for noticing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants