Closed laolarou726 closed 1 year ago
I am having this EXACT issue, too. It will just blow up while editing the code on another viewmodel which is open but not being edited. I didn't experience this issue until just a few days ago and now it's happening all the time to me. I'm having to exit and reopen a few times / hour.
I think in correlation to this issue, I'm experiencing an ObservableProperty issue which I think is related to this. You can see the open question here on SO: https://stackoverflow.com/questions/75326732/viewmodels-observablecollection-and-observableproperty-is-throwing-a-null-refer
I should say I can also duplicate this issue in the ViewModel by commenting out an observable property, wait a moment to get the compiler to throw some errors, then uncomment it. The net result is then all ObservableProperty variables defined in code will go into this:
If I exit VS and go back into it, these errors will go away.
I'm having a similiar issue, only that everything works...
I'm getting a bunch of "The name '
Used to have to reopen VS to make it go away but now I found out that just reloading a project works also.
Most commonly this happens on properties with these two attributes together:
[ObservableProperty] [NotifyCanExecuteChangedFor(nameof(CreateCardDesignCommand))]
But over time, more and more [ObservableProperty]
fields get marked as non-existing (In the same .cs file).. Looking in the autogenerated code I can see that the property really is not there.
Confirmed, the same for me. If I unload / reload the project it comes back, too.
I have the same issue if I hover over a variable where it says "[variable] does not exist in the current context".
I went through my other viewmodels and tried the same drill and every one of the them did the same thing as I mentioned.
In playing with this, I went to my most complex VM that I was working with prior on this issue and when I commented out a ObservableProperty variable then uncommented it back in again after seeing the expected error, only one other ObservableProperty variable came up with this issue. The last few times it was all of them (except for the one that was commented out).
Where are you seeing the autogenerated code? Also, are you .net 7 and/or did you update from .net 6?
It seems to allways start with [NotifyCanExecuteChangedFor(nameof(SomeMethod))]
attributes..
The methods in them are allways the first one to be labeled as Errors, then from there, other properties slowly get labeled too.
Didn't really find any pattern yet. My project is still in heavy development so I'm constantly adding views, models, viewmodels...
Fastest way I found to temporarily resolve this is to just unload/reload project or switching to another repo and back. It is mostly bothering me because I can't use hot-reload since there are these "errors".. Or in case of actual errors, they are hidden among these fake ones..
It's interesting how everything compiles regardless and works perfectly fine... maybe VS IDE just points to the wrong auto-generated file?
I can see the autogenerated code by pressing F12 on any of the properties that are not affected by this bug, which opens a file in VisualStudio and from there I can right-click on file tab and choose Open file location.
For me, this files are in C:\Users\
I'm still on .net5 :) It's an older project that I've refactored to use this toolkit, might update just in case.. didn't think of doing that yet.
Ok, I was wondering if it was .net 6 to .net 7 which is what I did with this project. I'm in the process of recreating the project in a native .net 7 app. Btw, going from 6 to 7 was very painful...
Get Outlook for Androidhttps://aka.ms/AAb9ysg
From: Rok Goljat @.> Sent: Friday, February 3, 2023 2:25:22 PM To: CommunityToolkit/dotnet @.> Cc: Scott Johnson @.>; Comment @.> Subject: Re: [CommunityToolkit/dotnet] SourceGenerator sometimes will cause compilation failed (Issue #584)
It seems to allways start with [NotifyCanExecuteChangedFor(nameof(SomeMethod))] attributes.. The methods in them are allways the first one to be labeled as Errors, then from there, other properties slowly get labeled too.
Didn't really find any pattern yet. My project is still in heavy development so I'm constantly adding views, models, viewmodels...
Fastest way I found to temporarily resolve this is to just unload/reload project or switching to another repo and back. It is mostly bothering me because I can't use hot-reload since there are these "errors".. Or in case of actual errors, they are hidden among these fake ones..
It's interesting how everything compiles regardless and works perfectly fine... maybe VS IDE just points to the wrong auto-generated file?
I can see the autogenerated code by pressing F12 on any of the properties that are not affected by this bug, which opens a file in VisualStudio and from there I can right-click on file tab and choose Open file location.
For me, this files are in C:\Users
I'm still on .net5 :) It's an older project that I've refactored to use this toolkit, might update just in case.. didn't think of doing that yet.
— Reply to this email directly, view it on GitHubhttps://github.com/CommunityToolkit/dotnet/issues/584#issuecomment-1416364843, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AD2HLVJL4I55W6QOB4EFKLTWVVSTFANCNFSM6AAAAAAUFXK75Q. You are receiving this because you commented.Message ID: @.***>
I've encountered this issue with version 8.1.0. Rolling back the package to version 8.0.0 fixed the issue for me.
Started getting this issue with 8.1.0 as well
Confirmed, going back to 8.0.0 resolved it, thanks faheys.
Could not build a fresh project with 8.1.0. Returning to 8.0 fixed for me as well.
Same, reverting to 8.0.0 fixed this issue
Closing as duplicate of #493, let's just use that one for tracking. This is also tracked in Roslyn by https://github.com/dotnet/roslyn/issues/67123.
Describe the bug
SourceGenerator sometimes will cause VS to fail to build the project. VS will not show any errors in the list but will show errors in the output window:
error CS0759: No definition declaration found for implementation declaration of partial method 'UIManager.OnSelectedBgFillColorChanged(SolidColorBrush?)'
Regression
810
Steps to reproduce
Actually, this bug seems randomly happened on my project. Every time my solution is to reboot the computer and reopen Visual Studio. If I use dotnet build to build the project, no errors will show and I'll get the compiled binary.
Expected behavior
The project should be compiled without any errors.
Screenshots
No response
IDE and version
VS 2022
IDE version
17.4.3
Nuget packages
Nuget package version(s)
8.1.0
Additional context
No response
Help us help you
Yes, I'd like to be assigned to work on this item