Coffeehouse Thread

4 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

VS2012 bug, can't generate from usage, new type

Back to Forum: Coffeehouse
  • User profile image

    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.


  • User profile image

    I suspect that the "Object reference not set to an instance of an object" message is thown by your first project as this function runs fine here. Perheps your first project use some late binding types from Type.GetTypeFromProgId() or Type.GetTypeFromCLSID() ?

    Recent Achievement unlocked: Code Avenger Tier 4/6: You see dead program. A lot!
    Last modified
  • User profile image

    If you follow the steps I outlined and create a brand new solution, with no classes yet in the projects except for the test project, the error message will still occur. I will double check though.


    Or, create 3 class library projects. Error still occurs.

  • User profile image

    I have two persistent bugs in VS2012

    if the startup project is config manager platform "any cpu", when starting in debug mode I get a "remote endpoint was unreachable" error. I get that error sometimes.  The fix is to change the platform from the any cpu default to x86.

    This one started recently. Maybe it is something I am doing. When I CTRL-TAB to see the open files in a project I see the same file opened multiple times.


Conversation locked

This conversation has been locked by the site admins. No new comments can be made.