Eventuous / eventuous

Event Sourcing library for .NET
https://eventuous.dev
Apache License 2.0
442 stars 70 forks source link

Fixed the issue with Any expected state for func services #261

Closed alexeyzimarev closed 1 year ago

alexeyzimarev commented 1 year ago

When using ExpectedState.Any in a func service, it crashes with an exception if the stream didn't exist.

It was caused by the code that tried to extract the new expected version from the stream, when the stream has no events, so calling Last on the sequence caused an exception,

github-actions[bot] commented 1 year ago

Qodana for .NET

781 new problems were found

Inspection name Severity Problems
Non-accessed positional property (non-private accessibility) 🔶 Warning 42
Auto-property accessor is never used (non-private accessibility) 🔶 Warning 12
Non-accessed field (private accessibility) 🔶 Warning 8
Possible unassigned object created by 'new' expression 🔶 Warning 8
Non-accessed positional property (private accessibility) 🔶 Warning 6
Unused parameter (private accessibility) 🔶 Warning 4
Unused local variable 🔶 Warning 3
Conditional access qualifier expression is not null according to nullable reference types' annotations 🔶 Warning 2
Return type of a function can be non-nullable 🔶 Warning 2
Redundant boolean comparison 🔶 Warning 2
XML comment has a 'param' tag for 'Parameter', but there is no parameter by that name 🔶 Warning 2
Member hides static member from outer class 🔶 Warning 2
Type member is never used (private accessibility) 🔶 Warning 2
Type member is never used (non-private accessibility) ◽️ Notice 437
Member can be made private (non-private accessibility) ◽️ Notice 76
Type is never used (non-private accessibility) ◽️ Notice 48
Auto-property can be made get-only (non-private accessibility) ◽️ Notice 26
Method return value is never used (non-private accessibility) ◽️ Notice 22
Unused parameter (non-private accessibility) ◽️ Notice 18
Member can be made protected (non-private accessibility) ◽️ Notice 16
Property can be made init-only (non-private accessibility) ◽️ Notice 8
Class is never instantiated (private accessibility) ◽️ Notice 6
Parameter type can be IEnumerable<T> (private accessibility) ◽️ Notice 4
Use preferred style of 'new' expression when created type is not evident ◽️ Notice 4
Type member is never accessed via base type (non-private accessibility) ◽️ Notice 4
Some values of the enum are not processed inside 'switch' expression and are handled via exception in default arm ◽️ Notice 4
Tail recursive call can be replaced with loop ◽️ Notice 2
Member can be made private (private accessibility) ◽️ Notice 2
Field can be made readonly (non-private accessibility) ◽️ Notice 2
Virtual (overridable) member is never overridden (non-private accessibility) ◽️ Notice 2
Return type can be IEnumerable<T> (non-private accessibility) ◽️ Notice 2
Some values of the enum are not processed inside 'switch' statement ◽️ Notice 2
Convert local variable or field into constant (private accessibility) ◽️ Notice 1

☁️ View the detailed Qodana report

Contact Qodana team Contact us at [qodana-support@jetbrains.com](mailto:qodana-support@jetbrains.com) - Or via our issue tracker: https://jb.gg/qodana-issue - Or share your feedback: https://jb.gg/qodana-discussions