question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Inexplicable Guid values

See original GitHub issue

So I have this fake object definition (), that has a fake method in it :

IFooRepositoryClass fooRepo = A.Fake<IFooRepositoryClass>();

A.CallTo(() => fooRepo.FooFunctionAsync(A<Guid>.Ignored).ReturnsLazily(
    (Guid fooId) => {
        fooInternalObject.DoSomething(fooId);
    }
);

As you can see, thing out of the ordinary.

Later, in my XUnit tests, I call the fake function :

Guid testGuid = new Guid("aaaaaaaa-9a88-4746-914b-aaaaaaaaaaaa"); //I changed to "aaaaa" to make it easily recognizable
await fooRepo.FooFunctionAsync(testGuid).configureAwait(false);

I put a breakpoint on that instruction : await fooRepo.FooFunctionAsync(testGuid).configureAwait(false); …I see that testGuid is indeed aaaaaaaa-9a88-4746-914b-aaaaaaaaaaaa

But then I put a breakpoint inside, on this instruction : fooInternalObject.DoSomething(fooId);

To my great surprise, fooId has a weird value with lots of zeros, different at each run! f933b838-007b-0000-0000-000000000000 785bb288-001a-0000-0000-000000000000 4d4bb8d8-0012-0000-0000-000000000000 etc.

What the hell is going on?

Even weirder : I shared my branch to a colleague. He has the exact same code as me. …But for him, fooId has the expected value, i.e. the value of testGuid! He shared his screen, I shared mine. Everything condition seems identical. Only the Guid differs : Expected value for him, bogus values for me. I cleaned the solution, rebuilt, even restarted VS. to no avail!

What the hell is going on? x2

I’m not expecting anyone to fix my unit tests, but maybe this is a well-known behaviour under certain conditions. Ever seen that? Especially those weird 000000 Guid values?


cross-posted to StackOverflow

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
thomaslevesquecommented, Nov 7, 2022

I don’t think that’s possible. I guess it would be possible in a language like C, but C# has strong typing enforced by the runtime. A DateTime can’t accidentally be interpreted as a GUID…

0reactions
jeancallisticommented, Nov 15, 2022

The mystery remains. I guess we’ll never know!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Inexplicable random "000000" Guid values in fake method
So I have this fake object definition, that has a fake method in it : // Note: This is a simplified version of...
Read more >
GUIDs are designed to be unique, not random
The GUID generation algorithm was designed for uniqueness. It was not designed for randomness or for unpredictability. Indeed, if you look at an ......
Read more >
what is the Disk identifier (GUID)?
The purpose of a UUID (or GUID) is to assign a unique ID number to something without any central authority. There are over...
Read more >
Using Guid for lookup values, NVL
I've got a question about my current database/business object design concerning the use of GUIDs for "lookup values".
Read more >
Creating a somewhat unique ID using the UUIDGEN function
The UUIDGEN function relies on code libraries that are system-dependent, as there are different algorithms for creating GUID values. When I run ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found