Limitations¶
What the current version of the library cannot do.
Result<Exception>declares fine, but implicit conversion from an exception fails with CS0457 (ambiguous user-defined conversions), because both cases take anException. Analyzer error FLU0004 reports the type. Wrap the payload in another type.- No
nullliteral for a result. Adefaultresult is an error; return a value or an exception instead. defaultis not caught byswitch. Aswitchexpression over adefaultresult throwsSwitchExpressionExceptionunless it has anullarm, and aswitchstatement runs no branch, because the compiler cannot see that state. Operators andMatchtreat it as an error. See The default result.- No
==on results.Result,Result<T>and your own result types define no equality operators, soa == bdoes not compile (CS0019).Equalsis the default struct equality: it compares the stored value or error with their ownEquals. Two results with equal records are equal, two results with distinct class instances are not, and two errors are equal only when they hold the same exception instance. - AOT and trimming need explicit converters. The core package is tested in native AOT and trimmed apps;
Option<T>of a value type and your own unions need the generic converters there, and several integration packages are not supported. See AOT and trimming. - Hand-written class unions were not investigated. The library is built on C#
uniondeclarations. - Entity Framework Core cannot map
Option<T>with a value converter. See Entity Framework Core for the backing-field pattern.
Back to: Getting started ยท Next: Result