Cant Execute a source generator on a file using TrySetAttributeAsync #435
Unanswered
prabhav-mehra
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a extension which creates a xml file based on another xml file, in a different format. I see the button in menu etc, but the source generator on the file doesn't run. I took the code snippet from the "SingleFileSourceGenerator" example.
the file.TrySetAttributeAsync returns true and the file also exisits, I checked by getting the full path.
I came across the VSIXSynchronizer code which has a different way of doing this, which actually partially works for me. This is the code for that.
The above code works partially for me. If I set GetDefaultExtension() in my source generator as ".cs" it creates one file with correct xml (which is fine but ofcourse I need a .xml extension). When I change the extension to ".xml" it goes in an infinite loop of creating the files and creates the file with name {FileName}(1^n).xml. So if file file name is test.xml, it creates test1.xml, test11.xml, test111.xml and so on till I stop the program (this doesnt happen when I change the extension to .cs).
UPDATE:
I got the first example to work partially but I do see the multiple file being generated still. So it does create FileName}(1^n).xml with the newer code.
Beta Was this translation helpful? Give feedback.
All reactions