Skip to content

NullReferenceException after upgrading to 2.2.6 #959

@majastrz

Description

@majastrz

Description

After upgrading both MSTest.TestAdapter and MSTest.TestFramework to 2.2.6, some of my tests are failing with a NullReferenceException that appears internal to the test framework.

Steps to reproduce

  1. Clone https://github.com/Azure/bicep
  2. Checkout the majastrz/try-update-tests-again branch.
  3. Run dotnet test from repo root.

Expected behavior

Tests pass like they do in the main branch.

Actual behavior

Many of the tests fail with the following exception (seen in the output of dotnet test):

  Failed GetPosition_ValidLineStartsAndOffset_ReturnsConvertedPosition (System.Collections.Immutable.ImmutableArray`1[System.Int32],0,(0, 0))
  Error Message:
   Object reference not set to an instance of an object.
  Stack Trace:
     at ReadArrayOfintFromJson(XmlReaderDelegator , XmlObjectSerializerReadContextComplexJson , XmlDictionaryString , XmlDictionaryString , CollectionDataContract )
   at System.Runtime.Serialization.Json.JsonCollectionDataContract.ReadJsonValueCore(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context)
   at System.Runtime.Serialization.Json.JsonDataContract.ReadJsonValue(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context)
   at System.Runtime.Serialization.Json.XmlObjectSerializerReadContextComplexJson.ReadDataContractValue(DataContract dataContract, XmlReaderDelegator reader)
   at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract& dataContract)
   at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, DataContract dataContract, String name, String ns)
   at System.Runtime.Serialization.Json.DataContractJsonSerializerImpl.InternalReadObject(XmlReaderDelegator xmlReader, Boolean verifyObjectName)
   at System.Runtime.Serialization.XmlObjectSerializer.InternalReadObject(XmlReaderDelegator reader, Boolean verifyObjectName, DataContractResolver dataContractResolver)
   at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName, DataContractResolver dataContractResolver)
   at System.Runtime.Serialization.Json.DataContractJsonSerializerImpl.ReadObject(XmlDictionaryReader reader)
   at System.Runtime.Serialization.Json.DataContractJsonSerializerImpl.ReadObject(Stream stream)

Environment

Local repro was on a Win10 machine. Will update issue once my CI job finishes failing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions