Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
This is a weird one. When unfolding t4 templates, NuPattern tries to close windows that might have been opened when adding a file (https://github.com/NuPattern/NuPattern/blob/be18383399bf1db558e52dd98e9af40a6fc45807/Src/Common/Source/Common.VisualStudio/Solution/VsFileTemplate.cs#L67-74)
If one of the open windows is a Project Properties page, asking the window for its ProjectItem throws an InvalidCastException.
Repro steps with the MVC sample:
You'll get an error:

This is arguably an issue in VS's code, but NuPattern could catch this exception and avoid failing. From what I could see there is no way to query the window to see if it would throw when returning its ProjectItem, as the properties have values just like the window for a code editor:
A try/catch on InvalidCastException on that look should fix this.