locked
VS2015 - ccrewrite.exe - Error Object reference not set to an instance of an object RRS feed

  • Question

  • We are using Visual Studio 2013 Premium and are in the process of migrating our main Solution (15 projects in all) over to Visual Studio 2015 Enterprise. We make extensive use of code contracts and I have encountered most of the 'quirks' and managed to deal with them as I do find using them a big benefit. 

    My environment (both versions of VS as I have the installed side by side on my dev machine) make use of the latest version of Code Contracts (currently: 1.9.10714.2)

    If I open the existing solution there is one core project, a class library, that will not build with Code Contracts enabled in VS2015. In VS2013, after a clean of the solution, it builds fine. So broken in VS2015 but working in 2013. I can reproduce this without changing any of my files (everything is version controlled in VS Online). 

    I copied the rewrite command line and tried to execute it directly from the command prompt. 

    "C:\Program Files (x86)\Microsoft\Contracts\Bin\ccrewrite.exe" "@MyProjectccrewrite.rsp" exited with code -1.
    ccrewrite(0,0) : error : Object reference not set to an instance of an object.

    What have I tried / not tried?

    • Deleted the entire code directory and pulled it in 'fresh' from our code repository and then directly try a build (after package restore) from VS 2015.
    • I have tried appending -verbose 5 but this does not produce any useful information.
    • I have also tried to migrate to .NET 4.6 in VS2015 to see if that produced a different result, it did not.
    • I have NOT tried changing the project configuration settings but I can if anyone knows of a specific setting that can/should be disabled.
    • Disabling extensions in VS2015 although I can reproduce the issue from the command line outside of VS so not sure if that should make a difference.
    • I will ask one of our other team members to see if they can reproduce it from their development PC.
    • Is this a known issue?

    What else can I try? How can I get a better error message that actually points me in the right direction (the dreaded 'object reference not set to....' message is a PITA that helps no one).

    Here is a screen shot of my project settings.



    Mark as answer or vote as helpful if you find it useful | Igor

    Tuesday, September 15, 2015 9:19 PM

Answers

  • Seems like its a bug in Code Contracts. I have submitted an issue which can be found here: GitHub - Code Contracts - Issue #247.


    Mark as answer or vote as helpful if you find it useful | Igor

    • Marked as answer by IWolbers Wednesday, September 16, 2015 10:29 AM
    Wednesday, September 16, 2015 10:29 AM