Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Object reference not set to an instance of an object. #57

Open
rcocks-hl opened this issue Nov 15, 2024 · 2 comments
Open

Error: Object reference not set to an instance of an object. #57

rcocks-hl opened this issue Nov 15, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@rcocks-hl
Copy link

rcocks-hl commented Nov 15, 2024

Describe the Bug

When running trx I get:

Error: Object reference not set to an instance of an object.

I appreciate this isn't a useful error message, is there any way I can run trx in debug or with more verbose logging to get a better error message or diagnose the problem?

Version info:
trx version 0.4.5 (2024-08-08)
https://github.com/devlooped/dotnet-trx/releases/tag/v0.4.5

Back this issue
Back this issue

@rcocks-hl rcocks-hl added the bug Something isn't working label Nov 15, 2024
@rcocks-hl
Copy link
Author

I just downloaded the source and found the --debug switch. I'll try to diagnose the root problem now also.

@rcocks-hl
Copy link
Author

Problematic result is this:

<UnitTestResult executionId="5033e502-576f-4e08-89b4-1d53f6a45aaa" testId="22122803-c423-9c37-65c6-590d4f329d0d" testName="<redacted>" computerName="<redacted>" startTime="2024-11-15T09:59:23.3949157+00:00" endTime="2024-11-15T09:59:23.3949157+00:00" testType="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b" outcome="NotExecuted" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" relativeResultsDirectory="5033e502-576f-4e08-89b4-1d53f6a45aaa">
      <Output>
        <StdOut>OneTimeSetUp:</StdOut>
        <ErrorInfo>
          <Message>OneTimeSetUp: </Message>
        </ErrorInfo>
      </Output>
    </UnitTestResult>

I've redacted the testName and computerName for privacy reasons, but the problem is that it errors trying to parse duration, which doesn't exist on this result node.

Line 135:

var elapsed = TimeSpan.Parse(result.Attribute("duration")!.Value);

is erroring,.

Replacing with:

var elapsed = TimeSpan.Parse(result.Attribute("duration")?.Value ?? "0");

Fixes the issue for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant