C
C#2y 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
Jayy2y ago
Restart VS
MODiX
MODiX2y ago
Orannis#3333
Restart VS
Quoted by
<@!190858129188192257> from #roslyn (click here)
React with ❌ to remove this embed.
Jayy
Jayy2y 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
Binto862y 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
Jayy2y 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
Binto862y 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
Jayy2y 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
333fred2y ago
No? Is the user going to be constantly editing the generator? If not (and they're not), reloading isn't an issue
Binto86
Binto862y ago
ah ok than thanks
Accord
Accord2y ago
✅ This post has been marked as answered!
Want results from more Discord servers?
Add your server
More Posts
Blazor WASM Hosted uses wrong basepath on page reloadHello! I have a web app that mostly works as it should, except on a Page Refresh or direct accessingCalling a static abstract method without a generic type [Answered]If I have this code with a static abstract member `Bar` in the interface `IFoo`, is there *any way* WinUI3 app doesn't run outside of Visual StudioI just tried to share a tool I made in WinUI3 with .NET6. That shouldn't be a problem with the publiLearning Agile and Scrum on my own, looking for advice, resources, insightsI haven't had the chance to work both in groups of developers nor in groups of developers working unProper C multicatch syntaxI saw in Java that you can do multicatch blocks (see image) I also looked it up on stackoverflow: Change output directory of nuget packageUsually, nuget package assemblies and dependencies are copied to OutDir during build, e.g. `bin\DebuCan someone help me? I got this errorHi, so i have table `Laporan_Penilaian` form another `database`. When i tried to run my project i goHow to use custom DateTimeConverter for selected endpoints?I have the following converter which is responsible for reading and returning dates in UTC format: `.NET Program that runs in the background [Answered]How would I make an .exe program in c# .NET that runs in the background (It will have a tray icon inHow do I check if a list in an IConfiguration has any values [Answered]I am trying to do this ```csharp if (_config.GetValue<bool>("AutoRegisterSlashCommands:Dev") && _con