none
SSDT Unit Tests VS2019: Object reference not set to an instance of an object. RRS feed

  • Question

  • In Visual Studio 2019, when I try to create Unit Tests in a SQL Server Data Tools project, the MSTest window initializes, but once it's done, the window disappears and I'm suddenly presented with the following:

    SSDT Unit Tests Exception

    Object reference not set to an instance of an object.

    at Microsoft.VisualStudio.Design.Serialization.CodeDom.MergedCodeDomParser.System.CodeDom.Compiler.ICodeParser.Parse(TextReader stream)
    at System.CodeDom.Compiler.CodeDomProvider.Parse(TextReader codeStream)
    at Microsoft.VisualStudio.Shell.Design.Serialization.CodeDom.CodeDomDocDataAdapter.get_CompileUnit()
    at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
    --- End of stack trace from previous location where exception was thrown ---
    at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
    at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.DeferredLoadHandler.Microsoft.VisualStudio.TextManager.Interop.IVsTextBufferDataEvents.OnLoadCompleted(Int32 fReload) 

    The really interesting part is that I'm encountering this problem on Visual Studio 2019 only.
    I also have a Visual Studio 2017 installation on the same workstation and SSDT Unit Tests work just fine there.

    I tried updating my VS2019 to latest version (16.3.1) but it didn't help.

    Besides trying to re-install VS2019 from scratch, is there anything else I can do to fix this?

    Thanks


    Eitan Blumin; SQL Server Consultant - Madeira Data Solutions

    Friday, September 27, 2019 7:08 AM

Answers

  • Hi EitanBlumin,

    Sorry for delay in reply.

    According to your description, please confirm if your Visual Studio has installed related components:

    And if they have been installed, please create a new SSDT with new SQL Unit test in visual studio 2019, it may be caused by version conflicts.

    Any feedback will be expected.

    Cheers,

    Dylan 


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    • Marked as answer by EitanBlumin Wednesday, October 2, 2019 1:56 PM
    Monday, September 30, 2019 5:17 AM

All replies

  • Hi EitanBlumin,

    Sorry for delay in reply.

    According to your description, please confirm if your Visual Studio has installed related components:

    And if they have been installed, please create a new SSDT with new SQL Unit test in visual studio 2019, it may be caused by version conflicts.

    Any feedback will be expected.

    Cheers,

    Dylan 


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    • Marked as answer by EitanBlumin Wednesday, October 2, 2019 1:56 PM
    Monday, September 30, 2019 5:17 AM
  • Thanks, Dylan!

    Re-creating the project in VS 2019 indeed solved the issue, so it appears to have been caused by a version conflict.

    Thank you!


    Eitan Blumin; SQL Server Consultant - Madeira Data Solutions

    Wednesday, October 2, 2019 1:56 PM