radimitrov / CSharpShellApp

77 stars 18 forks source link

Sourcegenerator not working #375

Closed sedoLevi609 closed 1 month ago

sedoLevi609 commented 2 months ago

@radimitrov Before the update I was able to write working source generator,but now they don't work(requires partial class inside solution,I exported them as dll and referenced from the project where I wanted to use the source generator). Please help me!

radimitrov commented 2 months ago

@sedoLevi609 There hasn't been an update to the Roslyn compiler packages. There should be no reason source generators would stop working. Can you provide a test case?

sedoLevi609 commented 2 months ago

@radimitrov This is simple example: SimpleExample.zip

sedoLevi609 commented 2 months ago

Sorry,my mistake: I generated code with wrong type of string (used 3 " instead of 1)

radimitrov commented 2 months ago

The quotes end up as just a syntax issue. This is caused by an update in March preventing source generators from being discovered. I'll see about fixing that soon.

sedoLevi609 commented 1 month ago

@radimitrov I found a bug( I think so) with source generators: if I make an attribute with source generator the solution where I use it doesn't find the attribute after closing and reopening the project(or the app,inside solution). I can only solve this by creating a new solution or regenerate the generator dll and reference it again.

sedoLevi609 commented 1 month ago

@radimitrov ifj you need an example: Example.zip

So reference generator as dll,then run Test project(it wil work),then exit app(or reopen solution) and run again Test project and it will say it doesn't find attribute(attribute needed to be added with source generator).

radimitrov commented 1 month ago

Looks like it all works now. I'm pushing it as another update today since it will be a while otherwise