-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Disable TargetingPack Analyzers #92648
Conversation
Tagging subscribers to this area: @dotnet/area-infrastructure-libraries Issue DetailsFix issue introduced in #92301 This makes it the default to remove all analyzers that come from the TargetingPack unless specified. This is important so that we don't mix the LKG binaries in the same process that will later load the live-built binaries. Doing so can result in the live built binaries being ignored since they have the same assembly name as those already loaded in process. I considered making this opt-in instead of opt-out, but I don't think we want anything in the repo loading the LKG binaries in the compiler process.
|
I'll need to reduce the condition down to just the latest framework. |
This might not actually fix the problem. @tarekgh noticed that he still sees a failure with this change. That's due to the failure happening when loading the For some reason the |
Doesn't this change partially undo 07ae197 which was observed as general goodness?
Shouldn't this infrastructure prevent that? |
@@ -172,6 +172,18 @@ | |||
</ItemGroup> | |||
</Target> | |||
|
|||
<!-- Don't use the TargetingPack Analyzers for current .NET version unless explicitly enabled --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I read this, it wasn't obvious to me that the target only applies to projects that don't use the local targeting / runtime pack. You want to point that out in the code comment.
For which projects should this target run? Microsoft.NETCore.Platforms doesn't use the local targeting pack but doesn't disable implicit framework references. Are there other such projects under src/libraries?
Here's the reason this was failing:
So during the runtime build, we include 8.0 analyzers from the ref pack, but the live built |
The area you're looking for is in generators.targets. However, I wonder if this is the correct fix. The generators that are included in the ref pack are designed for that particular TFM and they generally aren't designed to work downlevel. LibraryImportGenerator is the exception here, though that support is limited. It might be better to change generators.targets to not include the references to LibraryImportGenerator and Microsoft.Interop.SourceGeneration for downlevel netX.0 TFMs (we still need it for netstandard2.0). |
These two don't depend on that shared source generator and should still be consumed from the targeting pack. I believe a better fix would be to make sure that when that shared live built source generator is used ( |
@jkoritzinsky can you take a crack at fixing this in the way that makes the most sense for the interop source generators? My initial goal here was to minimize the use of those LKG generators when they'd be in torn state. Given we have very few projects targeting LKG for the latest .NET it seemed removing the generators for those would fix it - but I had missed the downlevel cases which seem to be more important. |
I'll take a look! |
Agreed for |
Fix issue introduced in #92301
This makes it the default to remove all analyzers that come from the TargetingPack unless specified.
This is important so that we don't mix the LKG binaries in the same process that will later load the live-built binaries. Doing so can result in the live built binaries being ignored since they have the same assembly name as those already loaded in process.
I considered making this opt-in instead of opt-out, but I don't think we want anything in the repo loading the LKG binaries in the compiler process.