-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
STJ source generation fails to compile without referencing the STJ package #68810
Comments
Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis Issue DetailsDescriptionUse STJ source generation with this
However, this can be worked around by referencing the STJ package in the project, even though the project already targets Reproduction StepsI attempted to make a minimal reproduction repo by copying the whole Expected behaviorBuild succeeds. Actual behaviorBuild fails. Regression?No response Known WorkaroundsNo response Configuration
Other informationNo response
|
Does the source generator produce any warning or error messages when you build? Does it fail to compile in the IDE, the command line, or both? Unfortunately, we would really need a minimal reproduction in order to take a closer look. I would recommend creating a separate branch in your repo, slowly removing components until the issue no longer reproduces. |
This issue has been marked |
No, the source generator does not emit any error messages. The 2 CS0534 errors are the only error messages.
It fails on both (my local VS2022 IDE and GitHub Actions). |
Thank you for the tip! Took me an hour to figure out which part of my app was causing this. I made a minimal reproduction repo: https://github.com/database64128/WPFRxUISTJSourceGenerationMinimalReproduction. There are 4 commits:
I also opened an issue at RxUI: reactiveui/ReactiveUI#3255 |
I also ran into what seems to be a very similar or even the same issue, I am seeing the exact same error messages in the following scenario: I have a WPF project with a XAML file that references a string from a ResX file. The same project contains a The minimal working example for my error case is here: https://github.com/ssrmm/mwe-system.text.json-wpftmp-error The readme file inside the repository contains some more details as well. To me it seems that the source generator from the runtime/SDK does not work together correctly with he |
Something seems to have changed since recently. The behavior is now different for certain VS/.NET SDK versions. In those versions the minimal example I posted above does compile without errors. However now there is a different problem: Referencing the NuGet package causes errors instead. The Full error logs
This is especially annoying when you are in an environment with multiple different VS/SDK version in use. Some machines will have compile errors when including the package and some will have erros when not including it. |
This commit basically reverts 24c516e, because .NET doesn't seem to like this anymore. dotnet/runtime#68810
Update: It was unrelated to this issue. reactivemarbles/ObservableEvents#130, dotnet/wpf#6792. |
@database64128 Can you clarify if you still have an unsolved issue here? Thanks! |
This issue has been marked |
@jeffhandley I noticed that this future item is still marked as blocking-release. Is that still the case? |
Sorry for the delay. I can confirm this particular issue has been fixed in the latest SDK version. |
Description
Use STJ source generation with this
Settings
class causes build to fail with:However, this can be worked around by referencing the STJ package in the project, even though the project already targets
net6.0-windows10.0.22000.0
.Reproduction Steps
I attempted to make a minimal reproduction repo by copying the whole
Settings
class, targetnet6.0-windows10.0.22000.0
and enableUseWPF
. It just won't reproduce. This bug can only be reproduced in this specific repo.Expected behavior
Build succeeds.
Actual behavior
Build fails.
Regression?
No response
Known Workarounds
No response
Configuration
Other information
No response
The text was updated successfully, but these errors were encountered: