Repository navigation
Conversation
MSBuild supplies Microsoft.NETCore.App.Ref reference assemblies for the target framework. Do not mix them with runtime framework assemblies, which prevents Roslyn from resolving enum constants and produces empty IDL enums.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #6.
Problem
When MSBuild passes framework reference assemblies to the code generator,
SchemaDiscoveryalso adds runtime assemblies (System.Private.CoreLiband the rest ofTRUSTED_PLATFORM_ASSEMBLIES). Roslyn then fails to resolve enum member constants, leavingEnumMembersempty. The generated IDL enum has no members andidlcfails.This was reproduced from a
net10.0project consuming thenet8.0package, with an enum equivalent to theValueTypeDiscriminatorused by a downstream schema.Fix
referencePathsalready containsMicrosoft.NETCore.App.Ref.Regression test
Added
FrameworkReferenceEnumTestscovering theValueTypeDiscriminatorshape with a framework reference pack. Before the fix, the test fails becauseEnumMembersis empty; after the fix, all members and values are retained.Verification
CycloneDDS.CodeGen.Testssuite passes: 212/212.net10.0project using the enum and package1.2.20compiles with the patched generator.net8.0; no TFM change is included.