C
C#3y ago
Binto86

Visual Studio doesn't work as expected with source generators [Answered]

I wanted to give source generators a try, i followed Microsoft tutorial and everything worked as expected, but than i changed some things, and the code works as i expected, but visual studio is apparently still thinking i am using the old implementation and gives me errors, but when i actually run it, it works just fine.
10 Replies
Jayy
Jayy3y ago
Restart VS
MODiX
MODiX3y ago
Orannis#3333
Restart VS
Quoted by
<@!190858129188192257> from #roslyn (click here)
React with ❌ to remove this embed.
Jayy
Jayy3y ago
Discussion link here about it From what i can tell in the discussion, the "reload quickly without restart with project reference" is not really a prioritized scenario so you have to restart to use it Cc @Orannis feel free to correct me on that
Binto86
Binto86OP3y ago
thanks vs reload works but thats really not what i would like the users to do as i am trying to create an library and the source generated output will differ a lot scenario to scenario
Jayy
Jayy3y ago
Are your users modifying the generator itself? If you read the thread i think the discussion is pretty clear about the ergonomics of what you can and can't do
Binto86
Binto86OP3y ago
ok i will read thru it ok this looks bad i am going to try create a wrapper for python (and possibly other languages too) to use in c#, so the output is going to depend on the provided python files if i understand the discussion correctly, that will be a problem?
Jayy
Jayy3y ago
Honestly, i bailed on source gens a while back when i got to the "have to restart" part. So I'm not super knowledgeable here 😅 I'd recommend dropping your use case question in the #roslyn channel and seeing what they say about it
333fred
333fred3y ago
No? Is the user going to be constantly editing the generator? If not (and they're not), reloading isn't an issue
Binto86
Binto86OP3y ago
ah ok than thanks
Accord
Accord3y ago
✅ This post has been marked as answered!
Want results from more Discord servers?
Add your server