Comments (10)
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.
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.
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.
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.
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.
Perhaps Microsoft.CodeAnalysis
should be added as embedded resource like the other DLLs added here:
from ntypewriter.
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.
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.
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.
Issue is fixed with latest release, therefore closed.
from ntypewriter.
Related Issues (20)
- Changes from GIT not picked up by NTypewriter HOT 3
- This is perfect for AI
- Failed to compile user code (System.Collections) HOT 10
- Source Generator ArgumentNullException HOT 8
- Save function is misleading HOT 3
- SourceGenerator can't find dependent projects HOT 2
- Publish latest releases as NuGet package HOT 4
- Template output preview is always displayed on top of everything HOT 1
- Template output preview with dark mode support
- Using C# 9.0 init accessors in a custom function gives an error inside Visual Studio extension HOT 1
- Extend AllReferencedTypes to search on Interfaces HOT 1
- Request - Property internal set vs public flag or filter HOT 3
- AttributeArgument.Value.Tostring() causes exception: TypedConstant is an array. Use Values property
- Unable to build project with SourceGenerator: 'ITypedConstant' could not be found HOT 2
- Unable to debug SourceGenerator, no output and no log files created HOT 6
- Why does Type.ToTypeScriptType ignore nullable if [Required] attribute is present? HOT 4
- Template processing fails when reading arguments from an Attribute that has arguments with default values (Roslyn project) HOT 3
- Missing default value for DateTime
- Incremental Generator HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ntypewriter.