chsienki / kittitas Goto Github PK
View Code? Open in Web Editor NEWAn In-Memory version of the Roslyn compiler that can be used to debug components in the Roslyn pipeline
License: MIT License
An In-Memory version of the Roslyn compiler that can be used to debug components in the Roslyn pipeline
License: MIT License
Cool project! This is not a bug but a list of links that you might find useful (or might already know about):
Hello Chris,
First off I'd like to apologize, my question isn't about Kittitas, but about source generators in general. If there is a better place to ask this kind of question, please let me know. I'm asking you directly because I get the impression you are the source gen expert.
I've been working on an approach to unit testing/debugging source generators in Visual Studio. My approach uses the Roslyn APIs directly to compile source and invoke the CSharpGeneratorDriver
directly inside the unit test project. I then Emit
the compilation to in-memory streams (both dll and pdb), then dynamically load the assembly/symbols into the unit test process and invoke the entry point method (compiled as console app). Doing this I am able to debug the code that implements my source generator, then also debug the result of the compilation. Unfortunately I'm only able to step through the code files that were statically included in the compilation (what would be the "user code") because I can point directly to the source files when I construct the CSharpSyntaxTree
.
Unfortunately, I can't figure out a way to also allow stepping through the code that the SourceGenerator emits. When constructing a SourceText
to add to the SourceGeneratorContext
there is a canBeEmbedded
parameter, which I interpreted to cause the generated source to be included in the pdb so it could be stepped through. Unfortunately, it doesn't seem to work. If I try to step into the generated code, Visual Studio asks me to navigate to the source file, which, of course, doesn't exist anywhere. The name of the source file VS is requesting appears to be generated "[GUID][GeneratorTypeName][hintName].cs". I was hoping I could save the generated code to a temp file with this name, and that the debugger would then be able to discover it. Unfortunately, I don't know where the [GUID] segment is coming from, so I can't even create such a file.
I also tried including the generate source by passing EmbeddedText to the compilation.Emit method. That didn't appear to make any difference, VS still prompted for source files. I'm not sure if I need the EmbeddedText filename to match exactly, which I can't do because I don't know the GUID comes from.
Do you know of a way to make this work? Is the "canBeEmbedded" parameter expected to achieve anything? If I was able to step through the generated code as well as the static code it would make the experience of authoring a source generator pretty seamless.
Thanks! I'd appreciate any guidance you can offer.
First: The NuGet version is 0.0.3-alpha, while the readme says 0.0.4-alpha. Is there another feed to use during alpha on this?
I changed this in both the tool install and the SDK reference
Second: I do not see the shim project in Visual Studio.
I'm happy to help clarify the readme on how to get this working, if I can get it to work :-)
Kittitas.SDK is incorrectly reporting that the launch settings already exists, and is not a kittitas settings, even when it is.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.