Code Monkey home page Code Monkey logo

Comments (10)

NeVeSpl avatar NeVeSpl commented on July 23, 2024 1

This is something new, something has changed in one of the latest versions of VS. What is interesting the exception happens after the source generator successfully generates files, *.ts files are saved on the disk, and *.cs files are added to the compilation, the build is done successfully, but generated *.cs files are not displayed in Solution Explorer.

from ntypewriter.

NeVeSpl avatar NeVeSpl commented on July 23, 2024 1

3.11 is the last one that is running under VS 2019, upgrading dependencies would mean dropping support for VS 2019. VS has binding redirects set up, so it is really strange that somehow still is looking for 3.11.

I do not have any custom analyzers, and I can reproduce exactly the same problem, an application can be built and run, and generated types exist at runtime, but somehow VS throws expectations during editing before adding them to compilation.

from ntypewriter.

NeVeSpl avatar NeVeSpl commented on July 23, 2024 1

I have published a new version of SG, with upgraded Microsoft.CodeAnalysis.* dependencies from 3.11 to 4.0.1, and a slightly more sophisticated approach to resolving assemblies.

It seems to work on the latest VS, and from MSBuild, but somehow when used with dotnet build, it is not always successful.

And answering your question, why Scriban.Signed , or any strongly named assembly: because you can load multiple versions of strongly named assemblies into the same app domain.

from ntypewriter.

ViRuSTriNiTy avatar ViRuSTriNiTy commented on July 23, 2024

Perhaps it helps to update the dependencies to the latest version? For example the package Microsoft.CodeAnalysis is at major version 4 something already. My guess is that other dependencies can be updated too.

from ntypewriter.

ViRuSTriNiTy avatar ViRuSTriNiTy commented on July 23, 2024

Another possible issue could be code analyzers running in the background. I have a custom one running in the background and it has some issues with respecting the rules applied via .editorconfig when NTypewriter.SourceGenerator adds something to the compilation. This is really strange and I should first verify whether this issue also exists with a source generator implemented on my own.

from ntypewriter.

ViRuSTriNiTy avatar ViRuSTriNiTy commented on July 23, 2024

Perhaps Microsoft.CodeAnalysis should be added as embedded resource like the other DLLs added here:

<!-- Above "official" way does not work sometimes, sooooo, to be sure, let us embedded dependencies -->

from ntypewriter.

ViRuSTriNiTy avatar ViRuSTriNiTy commented on July 23, 2024

It seems like we have a compiler toolset issue here, that cannot be reasolved easily or even reasolved at all.

This answer on SO provides a solution where you can enforce a specific toolset version. I did try all versions available and when I use like 3.1.something everything in my code breaks because I use latest C# features, .editorconfig is not working as expected etc.

Especially the .editorconfig thing caught my attention, because with NTypewriter added to the project, the source generated code is not analyzed correctly because rules set in .editorconfig are not working anymore. So, it seems like NTypewriter somehow enables an outdated toolset (to me it is outdated because I use latest VS 2022), which then produces issues.

Is there an option to compile NTypewriter with the latest versions of all dependencies and provide this compilation as a package? Like a preview version or something?

from ntypewriter.

ViRuSTriNiTy avatar ViRuSTriNiTy commented on July 23, 2024

Ok, the non-working .editorconfig is currently an open issue and the solution is to use .globalconfig, see dotnet/roslyn#47384 (comment). So, this is solved for me, but the initial issue still exists.

from ntypewriter.

ViRuSTriNiTy avatar ViRuSTriNiTy commented on July 23, 2024

It seems to work on the latest VS, and from MSBuild, but somehow when used with dotnet build, it is not always successful.

I can confirm that the not found error is now gone and dotnet build often does not execute the SG, but dotnet build --no-incremental does! The --no-incremental forces a rebuild, therefore also forces execution of the SG. I think this behavior is normal. With the old package, the SG also only always runs when rebuilding.

from ntypewriter.

ViRuSTriNiTy avatar ViRuSTriNiTy commented on July 23, 2024

Issue is fixed with latest release, therefore closed.

from ntypewriter.

Related Issues (20)

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.