From 73cd2950eefcf037dd245fc7b9abecefa4276a7a Mon Sep 17 00:00:00 2001 From: Matthias Dittrich Date: Fri, 22 Feb 2019 20:18:04 +0100 Subject: [PATCH] Allow non F# union-types to be used as messages fixes #20 Actually, I think this should have created problems for anyone not using F#-unions. --- src/debugger.fs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/debugger.fs b/src/debugger.fs index fcfb6e8..0d38a7e 100644 --- a/src/debugger.fs +++ b/src/debugger.fs @@ -63,8 +63,12 @@ module Program = open FSharp.Reflection let inline private duName (x:'a) = - match FSharpValue.GetUnionFields(x, typeof<'a>) with - | case, _ -> case.Name + let t = typeof<'a> + if (isNull t?cases) + then "not-a-f#-union" + else + match FSharpValue.GetUnionFields(x, t) with + | case, _ -> case.Name let inline private getCase<'msg> (cmd: 'msg) : obj = createObj ["type" ==> duName cmd