-
-
Notifications
You must be signed in to change notification settings - Fork 21
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
AD0001: InvalidOperationException on 2 rules #84
Comments
I encountered the same issue in one of our projects today and was able to narrow down the issue and created a small example to reproduce the problem.
|
same issue here getting
|
any updates on this? |
Could you share a code sample for that triggers this? |
my best guess is; using NodaTime;
using NodaTime.Extensions;
using System.Collections;
using System.Collections.Generic;
public class ProcessorTestsFixtureCollection : IEnumerable<object[]>
{
public IEnumerator<object[]> GetEnumerator()
{
yield return new object[]
{
new List<LocalDateTime>
{
SystemClock.Instance.InTzdbSystemDefaultZone().GetCurrentLocalDateTime() // current hour.
}
};
yield return new object[]
{
new List<LocalDateTime>
{
SystemClock.Instance.InTzdbSystemDefaultZone().GetCurrentLocalDateTime() - Period.FromHours(1) // a hour ago.
}
};
yield return new object[]
{
new List<LocalDateTime>
{
SystemClock.Instance.InTzdbSystemDefaultZone().GetCurrentLocalDateTime() - Period.FromHours(1), // a hour ago
SystemClock.Instance.InTzdbSystemDefaultZone().GetCurrentLocalDateTime() // current hour
}
};
yield return new object[]
{
new List<LocalDateTime>
{
SystemClock.Instance.InTzdbSystemDefaultZone().GetCurrentLocalDateTime() - Period.FromHours(1), // two hour ago
SystemClock.Instance.InTzdbSystemDefaultZone().GetCurrentLocalDateTime() - Period.FromHours(2) // a hour ago
}
};
yield return new object[]
{
new List<LocalDateTime>
{
SystemClock.Instance.InTzdbSystemDefaultZone().GetCurrentLocalDateTime() - Period.FromDays(1) // a day ago
}
};
yield return new object[]
{
new List<LocalDateTime>
{
SystemClock.Instance.InTzdbSystemDefaultZone().GetCurrentLocalDateTime() - Period.FromDays(1), // a day ago
SystemClock.Instance.InTzdbSystemDefaultZone().GetCurrentLocalDateTime() // current day
}
};
yield return new object[]
{
new List<LocalDateTime>
{
SystemClock.Instance.InTzdbSystemDefaultZone().GetCurrentLocalDateTime() - Period.FromDays(2), // two days ago.
SystemClock.Instance.InTzdbSystemDefaultZone().GetCurrentLocalDateTime() - Period.FromDays(1) // a day ago.
}
};
yield return new object[]
{
new List<LocalDateTime>
{
SystemClock.Instance.InTzdbSystemDefaultZone().GetCurrentLocalDateTime() - Period.FromMonths(1) // a month ago
}
};
yield return new object[]
{
new List<LocalDateTime>
{
SystemClock.Instance.InTzdbSystemDefaultZone().GetCurrentLocalDateTime() - Period.FromMonths(1), // a month ago
SystemClock.Instance.InTzdbSystemDefaultZone().GetCurrentLocalDateTime() // current month
}
};
yield return new object[]
{
new List<LocalDateTime>
{
SystemClock.Instance.InTzdbSystemDefaultZone().GetCurrentLocalDateTime() - Period.FromMonths(2), // two months ago
SystemClock.Instance.InTzdbSystemDefaultZone().GetCurrentLocalDateTime() - Period.FromMonths(1) // a month ago.
}
};
yield return new object[]
{
new List<LocalDateTime>
{
SystemClock.Instance.InTzdbSystemDefaultZone().GetCurrentLocalDateTime() - Period.FromMonths(2) - Period.FromDays(2) - Period.FromHours(2), // 2 months, 2 days, 2 hours ago
SystemClock.Instance.InTzdbSystemDefaultZone().GetCurrentLocalDateTime() - Period.FromMonths(1) - Period.FromDays(1) - Period.FromHours(1) // a month, a day and a hour ago.
}
};
}
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
} output;
|
I just hit this as well. This code works fine: var conditions = blocks[2].Questions[1].Conditions;
conditions.Should().HaveCount(1); This code triggers the exception: blocks[2].Questions[1].Conditions.Should().HaveCount(1) |
I'm not able to reproduce this anymore, I think was fixed in #100 |
If I'm not mistaken, #100 just swallows exception. So maybe the exception is no longer visible to the user, but it doesn't mean the underlying problem (whatever it is) is solved. |
Description
The rules
CollectionShouldContainSingleAnalyzer
andCollectionShouldBeEmptyAnalyzer
throwsInvalidOperationException
with messageThis operation does not apply to an empty instance
.For some weird reason, the stack trace disappear every time I try to expand the issue, this one is the only one which remains:
Complete minimal example reproducing the issue
My test project contains quite a lot of tests so it's quite hard to narrow down to the one failing but I hope that the stacktrace will help you understanding the failure.
Versions
Additional Information
Seems to be related to #78
The text was updated successfully, but these errors were encountered: