First, how to reproduce the "bug".

Create a new blank solution.

Create a new solution folder (Models for example)

Create a second folder (Unit.Tests for example)

Create 2 portable class libraries projects in the first (Models) folder.

Create a UnitTest project in the second (Unit.Tests) folder.

 

Try out the generate type by usage feature, selecting "Generate new type...", within a TestMethod in the UnitTest project.

Select the second portable class library project for where to place the file.

I get a error message. "Generate Type failed. Object reference not set to an instance of an object."

Unload the first project. Try again. This time it works. Reload first project, and it doesn't work again.

-----------

Solutions? I'm trying to get some work done.

The "Generate New Type" dialog sure could use some improvements. I have to copy the file name it suggests before selecting a different project then folder within that project, then paste the name back in. This slows down my productivity. (yeah, maybe I'm just nip-picking just a bit Smiley ).

Maybe I should just select the defaults and move the files afterwards to the proper project, and fix up the name space, and add in the reference to the project all manually instead.

-----

This bug is present in VS2010, as I loaded the VS2012 project as described above, created a new unit test project, as the 2012 version is not compatible, and same error.

----

Note that I can add a type to an existing file in any project, without error.

----

Update: the error happens even if you create the unit.test project in the same folder as the other projects.

----

Using C Sharp for all projects.