Comments (8)
I see that things escalated quickly.
Do you use by any chance custom functions/*.nt.cs files?
You can always try to debug source generator, the code of the SG is a very simple one.
Keep in mind, that VS extensions and source generator are running in the same app domain(inside VS process), they share the same dlls, if you mix the latest version of extension with not the latest version of SG, you may get exception like the second one from your post.
from ntypewriter.
I don't have any custom *.nt.cs files.
Do you have a link on how to debug something running inside VS like the source generator? I've done lots of debugging over the years but nothing "inside" VS like that so I'm not sure where to start.
I have 0.5.2 of the extension and 0.3.2 of the source generator. I don't have any other NTypeWriter packages or extensions installed. I did a reboot after updating the packages and extension and things got "better" in that they started attempting to generate again but I'm still getting the "Unexpected exception" error when the template renders on save via the extension and source gen still fails. I'll try one more reboot after posting this comment but unless I come back and go "yay it's fixed" you can assume that didn't help.
from ntypewriter.
You need two instances of VS,
- one instance with loaded project that uses SG
- second one with opened SG source code
and you simply do : Debug -> Attach to process - from the second to the first instance of VS
You can also replace SG nuget with straight forward reference to SG project the same way as it is done here :
from ntypewriter.
Haven't had any luck getting debugging working (yet) mostly following this https://github.com/JoanComasFdz/dotnet-how-to-debug-source-generator-vs2022 I was setting up for the attach when I noticed that the extension seemed fine after I uninstalled all the source generator nuget packages so I grabbed 1 of the 100+ projects and both the extension and the source generator appear to work with just that one so I guess I'll start binary searching the projects to see if I can figure out which one is making it blow up.
from ntypewriter.
I have suspicion that the output path of one of yours projects may be null, this line would definitely throw exception in such a case:
from ntypewriter.
I think that all problems mentioned here were addressed, unfortunately I am not able to updated old SG releases, but since now on, they should be completely independent from VS extension.
from ntypewriter.
@NeVeSpl I pulled the latest and built locally. That fixed the ArgumentNullException. Any idea when the next release might be?
I suggest adding a build failing diagnostic (instead of the current warning diagnostics) when no templates are found along the lines of "No *.nt template files were found. Please make sure there is a template present in the project and its Build Action is set to C# analyzer additional file". It doesn't make sense to me to have the source builder in a project and not be using it.
That last bit gets tricky when referencing files via "existing file links" as it jumps you to the actual file location if you left click on it, you have to right click first to be able to edit the link properties and set it as an additional file. Probably not worth adding that part to the error message as it's likely an uncommon scenario.
I have some hacked in diagnostics I might be able to create a PR for, but I'm already pushing the limits of the time I can spend on this at my employer.
Thanks for the responsiveness and quick fix!
from ntypewriter.
Nuget is already published, for small fixes I usually do not do releases.
Yeah, I am not fond of adding this failing diagnostics, I would prefer to leave it as it is. The core of NT is shared between, SG, VS extension, and Blazor app, I would prefer to keep it as end platform agnostic as possible.
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
- Save function is misleading HOT 3
- `Microsoft.CodeAnalysis` not found HOT 10
- 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.