diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index c268789..be6a22a 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,3 +1,6 @@ +### 5.2.10 +* try/with for Expr.TryGetReflectedDefinition (seems to raise exceptions in some cases) + ### 5.2.9 * Fixed issue with topological sort and raytracing data * Removed warnings in raytracing shaders diff --git a/src/Libs/FShade.Core/Serializer.fs b/src/Libs/FShade.Core/Serializer.fs index 9afa985..8f82cb2 100644 --- a/src/Libs/FShade.Core/Serializer.fs +++ b/src/Libs/FShade.Core/Serializer.fs @@ -823,7 +823,9 @@ module Serializer = let (|ReflectedCall|_|) (e : Expr) = match e with | Call(t,mi,args) -> - let isInline = mi.GetCustomAttributes() |> Seq.isEmpty |> not + let isInline = + try mi.GetCustomAttributes() |> Seq.isEmpty |> not + with _ -> false match ExprWorkardound.TryGetReflectedDefinition mi with | Some def -> let args = diff --git a/src/Libs/FShade.Imperative/Utilities.fs b/src/Libs/FShade.Imperative/Utilities.fs index 9b8bd4a..2077a3a 100644 --- a/src/Libs/FShade.Imperative/Utilities.fs +++ b/src/Libs/FShade.Imperative/Utilities.fs @@ -18,7 +18,8 @@ module ExprWorkardound = let TryGetReflectedDefinition (mb : MethodBase) = lock lockObj (fun _ -> - Expr.TryGetReflectedDefinition mb + try Expr.TryGetReflectedDefinition mb + with _ -> None ) module Peano =