Skip to content

NullReferenceException on Jenkins CI environment when using Match with snapshotName #199

@schinnerld

Description

@schinnerld

Describe the bug
NullReferenceException on Jenkins Agent when using Match overload with snapshotName. This does not occur on W10 development workstation. A workaround found ist to use the Match overload with snapshotFullName.

System.NullReferenceException: Object reference not set to an instance of an object.
at Snapshooter.Extensions.StringExtension.RemoveFilename(String filenameFullPath)
at Snapshooter.Extensions.StringExtension.GetDirectoryName(String filenameFullPath)
at Snapshooter.MSTest.MSTestSnapshotFullNameReader.ReadSnapshotFullName()
at Snapshooter.SnapshotFullNameResolver.ResolveSnapshotFullName(String snapshotName, String snapshotNameExtension)
at Snapshooter.Snapshooter.ResolveSnapshotFullName(String snapshotName, SnapshotNameExtension snapshotNameExtension)
at Snapshooter.MSTest.Snapshot.FullName(String snapshotName)
at Snapshooter.MSTest.Snapshot.Match(Object currentResult, String snapshotName, Func2 matchOptions) at Snapshooter.MSTest.Snapshot.Match[T](T currentResult, String snapshotName, Func2 matchOptions)
at ABCTests.XYZApprovalTest()

To Reproduce
Steps to reproduce the behavior:

Expected behavior
No exception is thrown.

Desktop:
Windows Server 2022 10.0.20348
VMWare 7.1
Jenkins Windows Agent 3261.v9c670a_4748a_9
SnapShooter.MSTest 0.14.1

Additional context
Strong guess that stackFrame.GetFileName() returns null in MSTestSnapShotFullNameReader ln 39.

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