diff --git a/build/CommandLine.fs b/build/CommandLine.fs
index 9af384bd5..60af3d86c 100644
--- a/build/CommandLine.fs
+++ b/build/CommandLine.fs
@@ -74,7 +74,9 @@ with
seq {
for c in cases do
if c.GetFields().Length = 0 then
- FSharpValue.MakeUnion(c, [| |]) :?> Build
+ match FSharpValue.MakeUnion(c, [| |]) with
+ | NonNull u -> u :?> Build
+ | _ -> failwithf $"%s{c.Name} can not be cast to Build enum"
}
static member Ignore (_: Build) _ = ()
diff --git a/build/build.fsproj b/build/build.fsproj
index e68967acf..dd45f5a01 100644
--- a/build/build.fsproj
+++ b/build/build.fsproj
@@ -12,8 +12,6 @@
-
-
diff --git a/src/Elastic.Markdown/Diagnostics/DiagnosticsChannel.cs b/src/Elastic.Markdown/Diagnostics/DiagnosticsChannel.cs
index d6848520d..bc80aa84e 100644
--- a/src/Elastic.Markdown/Diagnostics/DiagnosticsChannel.cs
+++ b/src/Elastic.Markdown/Diagnostics/DiagnosticsChannel.cs
@@ -56,7 +56,7 @@ public readonly record struct Diagnostic
public interface IDiagnosticsOutput
{
- public void Write(Diagnostic diagnostic);
+ void Write(Diagnostic diagnostic);
}
public class DiagnosticsCollector(IReadOnlyCollection outputs)
diff --git a/tests/authoring/Framework/ErrorCollectorAssertions.fs b/tests/authoring/Framework/ErrorCollectorAssertions.fs
index c23d80751..95c4c9033 100644
--- a/tests/authoring/Framework/ErrorCollectorAssertions.fs
+++ b/tests/authoring/Framework/ErrorCollectorAssertions.fs
@@ -27,8 +27,14 @@ module DiagnosticsCollectorAssertions =
.Where(fun d -> d.Severity = Severity.Error)
.ToArray()
|> List.ofArray
- let message = errorDiagnostics.FirstOrDefault().Message
- test <@ message.Contains(expected) @>
+ |> List.tryHead
+
+ match errorDiagnostics with
+ | Some e ->
+ let message = e.Message
+ test <@ message.Contains(expected) @>
+ | None -> failwithf "Expected errors but no errors were logged"
+
let hasNoWarnings (actual: Lazy) =
let actual = actual.Value
@@ -43,5 +49,9 @@ module DiagnosticsCollectorAssertions =
.Where(fun d -> d.Severity = Severity.Warning)
.ToArray()
|> List.ofArray
- let message = errorDiagnostics.FirstOrDefault().Message
- test <@ message.Contains(expected) @>
+ |> List.tryHead
+ match errorDiagnostics with
+ | Some e ->
+ let message = e.Message
+ test <@ message.Contains(expected) @>
+ | None -> failwithf "Expected errors but no errors were logged"