Giter Site home page Giter Site logo

kittitas's People

Contributors

chsienki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kittitas's Issues

Ideas for populating the Roslyn workspace

Cool project! This is not a bug but a list of links that you might find useful (or might already know about):

  1. https://github.com/KirillOsenkov/SourceBrowser is all about reading an .sln/.csproj and populating the MSBuildWorkspace, which in turn produces Compilations etc.
  2. Note that it can also read C# compiler invocations from .binlog files (obtained via https://msbuildlog.com). This way you can build a codebase with /bl, and then "open" the .binlog in the workspace to produce the compilations. Here are more details: https://github.com/KirillOsenkov/SourceBrowser/wiki/Indexing-.binlogs
  3. Check out https://github.com/daveaglick/Buildalyzer by @daveaglick which is similar in that it also emulates the build process to populate the Roslyn workspace

Question about embedding generated source in pdbs

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.

Inconsistencies in ReadMe for version and unable to run

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.

  • Should the .csproj be in the same folder as the .csproj for the console app I am running the generator on? Or some other location?
  • Does the NuGet 0.0.3 version support the shim project to Visual Studio
  • Am I correct that in the dropdown that has my project should now include a new item for the new project? Are there any restrictions on the project name.

I'm happy to help clarify the readme on how to get this working, if I can get it to work :-)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.