You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With regards to #333, I understand that the supression does not work inside an Assert.Multiple block. But I would have expect the following scenario to work, which I typically use for such cases.
var e = Assert.Throws<Exception>(() => throw new Exception("Test"));
Assert.Multiple(() =>
{
Assert.That(e.Message, Is.EqualTo("Test'")); // I see a warning here that e might be null
Assert.That(e.InnerException, Is.Null);
Assert.That(e.StackTrace, Is.Not.Empty);
});
If I remove the Assert.Multiple block, the warning is correctly suppressed.
var e = Assert.Throws<Exception>(() => throw new Exception("Test"));
Assert.That(e.Message, Is.EqualTo("Test'")); // no warning now
Assert.That(e.InnerException, Is.Null);
Assert.That(e.StackTrace, Is.Not.Empty);
Is this some limitation that could be removed?
I am using the 3.0 Version in Visual Studio 2019 Preview 16.9
The text was updated successfully, but these errors were encountered:
Without looking at the code I think we should be able to determine that the assignment happens outside the Assert.Multiple, but I'm unsure how much this will complicate the code.
Roslyn raises the 'possible null reference exception' on the line Assert.That(e.Message, Is.EqualTo("Test'"));.
The code then determines that this line is inside the Assert.Multiple and stops any search for the assignment and hence doesn't suppress. I will see if I can update the code to search for the assignment regardless. @mikkelbu Please assign the ticket to me.
With regards to #333, I understand that the supression does not work inside an
Assert.Multiple
block. But I would have expect the following scenario to work, which I typically use for such cases.If I remove the
Assert.Multiple
block, the warning is correctly suppressed.Is this some limitation that could be removed?
I am using the 3.0 Version in Visual Studio 2019 Preview 16.9
The text was updated successfully, but these errors were encountered: