Mirror [Obsolete] onto generated image properties#15
Merged
Conversation
Generated image wrapper properties now replicate the [Obsolete] attribute of the underlying entity property. This suppresses the CS0612/CS0618 deprecation warning inside the auto-generated accessor (references to obsolete members from within an obsolete member are not reported) while pushing the warning to the actual calling code that reads the deprecated image member. Covers both explicitly registered deprecated attributes and those captured implicitly via full-entity images. Co-Authored-By: Claude <[email protected]> via Conducktor <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the source generator so that generated image wrapper properties mirror System.ObsoleteAttribute from the underlying Dataverse entity properties, preventing CS0612/CS0618 warnings from originating inside generated code while ensuring they surface at the actual call sites.
Changes:
- Capture
[Obsolete]metadata (message +isError) from entity properties during registration parsing and include it in attribute metadata. - Emit
[System.Obsolete(...)]on generated image wrapper properties when the underlying entity property is obsolete. - Add generator tests to ensure obsolete diagnostics do not originate from generated trees and are pushed to user code; update test context artifacts/config accordingly.
Reviewed changes
Copilot reviewed 59 out of 59 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| XrmPluginCore/CHANGELOG.md | Documents the behavioral change for obsolete warnings in generated image wrappers. |
| XrmPluginCore.SourceGenerator/Parsers/RegistrationParser.cs | Extracts [Obsolete] info from entity properties into generator metadata. |
| XrmPluginCore.SourceGenerator/Models/PluginStepMetadata.cs | Extends AttributeMetadata to carry obsolete state/message/error flag. |
| XrmPluginCore.SourceGenerator/CodeGeneration/WrapperClassGenerator.cs | Emits [System.Obsolete] on generated wrapper properties based on captured metadata. |
| XrmPluginCore.SourceGenerator.Tests/IntegrationTests/CompilationTests.cs | Adds integration coverage asserting obsolete warnings don’t come from generated code and are pushed to user code. |
| XrmPluginCore.SourceGenerator.Tests/Helpers/TestFixtures.cs | Adds fixture sources covering explicit obsolete image attributes and calling-code warning behavior. |
| XrmPluginCore.SourceGenerator.Tests/GenerationTests/WrapperClassGenerationTests.cs | Asserts generated wrapper code includes [System.Obsolete] on deprecated image properties. |
| XrmPluginCore.Tests.Context/BusinessDomain/tables/Account.cs | Adds a deprecated test attribute (ctx_DeprecatedField) and a new N:N relationship for context testing. |
| XrmPluginCore.Tests.Context/BusinessDomain/tables/Contact.cs | Adds the counterpart N:N relationship for context testing. |
| XrmPluginCore.Tests.Context/BusinessDomain/optionsets/powerpagelanguages.cs | Adds additional localized OptionSetMetadata labels (LCID 1030). |
| XrmPluginCore.Tests.Context/BusinessDomain/optionsets/contact_territorycode.cs | Adds localized OptionSetMetadata (LCID 1030). |
| XrmPluginCore.Tests.Context/BusinessDomain/optionsets/contact_statuscode.cs | Adds localized OptionSetMetadata (LCID 1030). |
| XrmPluginCore.Tests.Context/BusinessDomain/optionsets/contact_statecode.cs | Adds localized OptionSetMetadata (LCID 1030). |
| XrmPluginCore.Tests.Context/BusinessDomain/optionsets/contact_shippingmethodcode.cs | Adds localized OptionSetMetadata (LCID 1030). |
| XrmPluginCore.Tests.Context/BusinessDomain/optionsets/contact_preferredcontactmethodcode.cs | Adds localized OptionSetMetadata (LCID 1030). |
| XrmPluginCore.Tests.Context/BusinessDomain/optionsets/contact_preferredappointmenttimecode.cs | Adds localized OptionSetMetadata (LCID 1030). |
| XrmPluginCore.Tests.Context/BusinessDomain/optionsets/contact_preferredappointmentdaycode.cs | Adds localized OptionSetMetadata (LCID 1030). |
| XrmPluginCore.Tests.Context/BusinessDomain/optionsets/contact_paymenttermscode.cs | Adds localized OptionSetMetadata (LCID 1030). |
| XrmPluginCore.Tests.Context/BusinessDomain/optionsets/contact_leadsourcecode.cs | Adds localized OptionSetMetadata (LCID 1030). |
| XrmPluginCore.Tests.Context/BusinessDomain/optionsets/contact_haschildrencode.cs | Adds localized OptionSetMetadata (LCID 1030). |
| XrmPluginCore.Tests.Context/BusinessDomain/optionsets/contact_gendercode.cs | Adds localized OptionSetMetadata (LCID 1030). |
| XrmPluginCore.Tests.Context/BusinessDomain/optionsets/contact_familystatuscode.cs | Adds localized OptionSetMetadata (LCID 1030). |
| XrmPluginCore.Tests.Context/BusinessDomain/optionsets/contact_educationcode.cs | Adds localized OptionSetMetadata (LCID 1030). |
| XrmPluginCore.Tests.Context/BusinessDomain/optionsets/contact_customertypecode.cs | Adds localized OptionSetMetadata (LCID 1030). |
| XrmPluginCore.Tests.Context/BusinessDomain/optionsets/contact_customersizecode.cs | Adds localized OptionSetMetadata (LCID 1030). |
| XrmPluginCore.Tests.Context/BusinessDomain/optionsets/contact_address3_shippingmethodcode.cs | Adds localized OptionSetMetadata (LCID 1030). |
| XrmPluginCore.Tests.Context/BusinessDomain/optionsets/contact_address3_freighttermscode.cs | Adds localized OptionSetMetadata (LCID 1030). |
| XrmPluginCore.Tests.Context/BusinessDomain/optionsets/contact_address3_addresstypecode.cs | Adds localized OptionSetMetadata (LCID 1030). |
| XrmPluginCore.Tests.Context/BusinessDomain/optionsets/contact_address2_shippingmethodcode.cs | Adds localized OptionSetMetadata (LCID 1030). |
| XrmPluginCore.Tests.Context/BusinessDomain/optionsets/contact_address2_freighttermscode.cs | Adds localized OptionSetMetadata (LCID 1030). |
| XrmPluginCore.Tests.Context/BusinessDomain/optionsets/contact_address2_addresstypecode.cs | Adds localized OptionSetMetadata (LCID 1030). |
| XrmPluginCore.Tests.Context/BusinessDomain/optionsets/contact_address1_shippingmethodcode.cs | Adds localized OptionSetMetadata (LCID 1030). |
| XrmPluginCore.Tests.Context/BusinessDomain/optionsets/contact_address1_freighttermscode.cs | Adds localized OptionSetMetadata (LCID 1030). |
| XrmPluginCore.Tests.Context/BusinessDomain/optionsets/contact_address1_addresstypecode.cs | Adds localized OptionSetMetadata (LCID 1030). |
| XrmPluginCore.Tests.Context/BusinessDomain/optionsets/contact_accountrolecode.cs | Adds localized OptionSetMetadata (LCID 1030). |
| XrmPluginCore.Tests.Context/BusinessDomain/optionsets/activityparty_participationtypemask.cs | Adds localized OptionSetMetadata (LCID 1030). |
| XrmPluginCore.Tests.Context/BusinessDomain/optionsets/activityparty_instancetypecode.cs | Adds localized OptionSetMetadata (LCID 1030). |
| XrmPluginCore.Tests.Context/BusinessDomain/optionsets/account_territorycode.cs | Adds localized OptionSetMetadata (LCID 1030). |
| XrmPluginCore.Tests.Context/BusinessDomain/optionsets/account_statuscode.cs | Adds localized OptionSetMetadata (LCID 1030). |
| XrmPluginCore.Tests.Context/BusinessDomain/optionsets/account_statecode.cs | Adds localized OptionSetMetadata (LCID 1030). |
| XrmPluginCore.Tests.Context/BusinessDomain/optionsets/account_shippingmethodcode.cs | Adds localized OptionSetMetadata (LCID 1030). |
| XrmPluginCore.Tests.Context/BusinessDomain/optionsets/account_preferredcontactmethodcode.cs | Adds localized OptionSetMetadata (LCID 1030). |
| XrmPluginCore.Tests.Context/BusinessDomain/optionsets/account_preferredappointmenttimecode.cs | Adds localized OptionSetMetadata (LCID 1030). |
| XrmPluginCore.Tests.Context/BusinessDomain/optionsets/account_preferredappointmentdaycode.cs | Adds localized OptionSetMetadata (LCID 1030). |
| XrmPluginCore.Tests.Context/BusinessDomain/optionsets/account_paymenttermscode.cs | Adds localized OptionSetMetadata (LCID 1030). |
| XrmPluginCore.Tests.Context/BusinessDomain/optionsets/account_ownershipcode.cs | Adds localized OptionSetMetadata (LCID 1030). |
| XrmPluginCore.Tests.Context/BusinessDomain/optionsets/account_customertypecode.cs | Adds localized OptionSetMetadata (LCID 1030). |
| XrmPluginCore.Tests.Context/BusinessDomain/optionsets/account_customersizecode.cs | Adds localized OptionSetMetadata (LCID 1030). |
| XrmPluginCore.Tests.Context/BusinessDomain/optionsets/account_businesstypecode.cs | Adds localized OptionSetMetadata (LCID 1030). |
| XrmPluginCore.Tests.Context/BusinessDomain/optionsets/account_address2_shippingmethodcode.cs | Adds localized OptionSetMetadata (LCID 1030). |
| XrmPluginCore.Tests.Context/BusinessDomain/optionsets/account_address2_freighttermscode.cs | Adds localized OptionSetMetadata (LCID 1030). |
| XrmPluginCore.Tests.Context/BusinessDomain/optionsets/account_address2_addresstypecode.cs | Adds localized OptionSetMetadata (LCID 1030). |
| XrmPluginCore.Tests.Context/BusinessDomain/optionsets/account_address1_shippingmethodcode.cs | Adds localized OptionSetMetadata (LCID 1030). |
| XrmPluginCore.Tests.Context/BusinessDomain/optionsets/account_address1_freighttermscode.cs | Adds localized OptionSetMetadata (LCID 1030). |
| XrmPluginCore.Tests.Context/BusinessDomain/optionsets/account_address1_addresstypecode.cs | Adds localized OptionSetMetadata (LCID 1030). |
| XrmPluginCore.Tests.Context/BusinessDomain/optionsets/account_accountratingcode.cs | Adds localized OptionSetMetadata (LCID 1030). |
| XrmPluginCore.Tests.Context/BusinessDomain/optionsets/account_accountclassificationcode.cs | Adds localized OptionSetMetadata (LCID 1030). |
| XrmPluginCore.Tests.Context/BusinessDomain/optionsets/account_accountcategorycode.cs | Adds localized OptionSetMetadata (LCID 1030). |
| appsettings.json | Updates local generation configuration (deprecated prefix + solution scoping). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
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.
Generated image wrapper properties now replicate the [Obsolete]
attribute of the underlying entity property. This suppresses the
CS0612/CS0618 deprecation warning inside the auto-generated accessor
(references to obsolete members from within an obsolete member are not
reported) while pushing the warning to the actual calling code that
reads the deprecated image member.
Covers both explicitly registered deprecated attributes and those
captured implicitly via full-entity images.
Co-Authored-By: Claude [email protected] via Conducktor [email protected]