SteveDunn / Vogen

A semi-opinionated library which is a source generator and a code analyser. It Source generates Value Objects
Apache License 2.0
782 stars 46 forks source link

fix: prefix STJ generated file namespace with global #654

Closed jupjohn closed 1 month ago

jupjohn commented 1 month ago

Noticed this today at work where STJ conversion generated code wasn't compiling. This was caused by the namespace looking something like Abc.Def.Abc which is a classic way to break source generators when they're not prefixing namespaces with global::. This should fix the values of both the key & value's Lazy<T> factory.

This PR is crazy big because it shows up in almost every snapshot test. Adding these individually in path mode without zoning out was a real test.

Love ya' work Steve, keep doing what you're doing!

SteveDunn commented 1 month ago

Noticed this today at work where STJ conversion generated code wasn't compiling. This was caused by the namespace looking something like Abc.Def.Abc which is a classic way to break source generators when they're not prefixing namespaces with global::. This should fix the values of both the key & value's Lazy<T> factory.

This PR is crazy big because it shows up in almost every snapshot test. Adding these individually in path mode without zoning out was a real test.

Love ya' work Steve, keep doing what you're doing!

Many thanks! How did you reset the snapshots? There's a command line script to do that:

.\RunSnapshots.ps1 -v "minimal" -reset

I'll merge down and do that. Thanks again for the contribution!

jupjohn commented 1 month ago

Cheers. I enabled auto verification, then reviewed them when staging in git 👌