Inexplicable Guid values
See original GitHub issueSo 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?
Issue Analytics
- State:
- Created a year ago
- Comments:8 (4 by maintainers)
Top GitHub Comments
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…The mystery remains. I guess we’ll never know!