Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DynamicTextTransformation fails since GenerationEnvironment property is now public #9

Open
gitfool opened this issue Feb 8, 2024 · 0 comments

Comments

@gitfool
Copy link

gitfool commented Feb 8, 2024

FWIW, I just tried using this tool with Visual Studio 2022 (17.9.0 Preview 5.0) and it failed with the following error:

Error		Running transformation: System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.VisualStudio.TextTemplating375A1FF1DB56D345CF6C793FF482ACD833FB60B96D9461371457541944B520BF4D9710C7CED185C0A8F727B5DB680AD493A29F76721197FB9A90D2CF2F62367B.GeneratedTextTransformation.DynamicTextTransformation.get_GenerationEnvironment()
   at Microsoft.VisualStudio.TextTemplating375A1FF1DB56D345CF6C793FF482ACD833FB60B96D9461371457541944B520BF4D9710C7CED185C0A8F727B5DB680AD493A29F76721197FB9A90D2CF2F62367B.GeneratedTextTransformation.EntityFrameworkTemplateFileManager..ctor(Object textTransformation)
   at Microsoft.VisualStudio.TextTemplating375A1FF1DB56D345CF6C793FF482ACD833FB60B96D9461371457541944B520BF4D9710C7CED185C0A8F727B5DB680AD493A29F76721197FB9A90D2CF2F62367B.GeneratedTextTransformation.EntityFrameworkTemplateFileManager.VsEntityFrameworkTemplateFileManager..ctor(Object textTemplating)
   at Microsoft.VisualStudio.TextTemplating375A1FF1DB56D345CF6C793FF482ACD833FB60B96D9461371457541944B520BF4D9710C7CED185C0A8F727B5DB680AD493A29F76721197FB9A90D2CF2F62367B.GeneratedTextTransformation.EntityFrameworkTemplateFileManager.Create(Object textTransformation)
   at Microsoft.VisualStudio.TextTemplating375A1FF1DB56D345CF6C793FF482ACD833FB60B96D9461371457541944B520BF4D9710C7CED185C0A8F727B5DB680AD493A29F76721197FB9A90D2CF2F62367B.GeneratedTextTransformation.TransformText()	Test	D:\Devel\gitfool\Test\Scripts\TypeLite.tt	1	

But I then managed to get it to work by changing TypeLitePlus.T4/Scripts/Manager.ttinclude#L464 from:

_generationEnvironment = type.GetProperty("GenerationEnvironment", BindingFlags.Instance | BindingFlags.NonPublic);

to:

_generationEnvironment = type.GetProperty("GenerationEnvironment");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant