Expr.TryGetReflectedDefinition on Blazor WebAssembly
- Dominant language
- F#
- Stars
- 4.3k
- Forks
- 876
- Avg merge
- 4d 22h
- Merged PRs (30d)
- 144
Description
In our Blazor WebAssembly project `Expr.TryGetReflectedDefinition` fails when I change definetly unrelated parts of the code.
Basically we use quotations for our shaders in FShade and by changing an entirely different part of the code we suddenly see
this error message
update failed: System.InvalidOperationException: type argument out of range
blazor.webassembly.js:1 at Microsoft.FSharp.Quotations.PatternsModule.mkTyparSubst@2006.Invoke(Int32 idx) in D:\a\_work\1\s\src\FSharp.Core\quotations.fs:line 2010
blazor.webassembly.js:1 at Microsoft.FSharp.Quotations.PatternsModule.u_dtype@1969.Invoke(FSharpFunc`2 env) in D:\a\_work\1\s\src\FSharp.Core\quotations.fs:line 1969
blazor.webassembly.js:1 at Microsoft.FSharp.Quotations.PatternsModule.appL@1963[[Microsoft.FSharp.Core.FSharpFunc`2[[System.Int32, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Type, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], FSharp.Core, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a],[System.Type, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Invoke(FSharpFunc`2 f) in D:\a\_work\1\s\src\FSharp.Core\quotations.fs:line 1963
blazor.webassembly.js:1 at Microsoft.FSharp.Primitives.Basics.List.map[FSharpFunc`2,Type](FSharpFunc`2 mapping, FSharpList`1 x) in D:\a\_work\1\s\src\FSharp.Core\local.fs:line 245
blazor.webassembly.js:1 at Microsoft.FSharp.Quotations.PatternsModule.appL[FSharpFunc`2,Type](FSharpList`1 fs, FSharpFunc`2 env) in D:\a\_work\1\s\src\FSharp.Core\quotations.fs:line 1963
blazor.webassembly.js:1 at Microsoft.FSharp.Quotations.PatternsModule.u_dtype@1970-3.Invoke(FSharpFunc`2 env) in D:\a\_work\1\s\src\FSharp.Core\quotations.fs:line 1970
blazor.webassembly.js:1 at Microsoft.FSharp.Quotations.PatternsModule.appL@1963[[Microsoft.FSharp.Core.FSharpFunc`2[[System.Int32, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Type, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], FSharp.Core, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a],[System.Type, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Invoke(FSharpFunc`2 f) in D:\a\_work\1\s\src\FSharp.Core\quotations.fs:line 1963
blazor.webassembly.js:1 at Microsoft.FSharp.Primitives.Basics.List.map[FSharpFunc`2,Type](FSharpFunc`2 mapping, FSharpList`1 x) in D:\a\_work\1\s\src\FSharp.Core\local.fs:line 243
blazor.webassembly.js:1 at Microsoft.FSharp.Quotations.PatternsModule.appL[FSharpFunc`2,Type](FSharpList`1 fs, FSharpFunc`2 env) in D:\a\_work\1\s\src\FSharp.Core\quotations.fs:line 1963
blazor.webassembly.js:1 at Microsoft.FSharp.Quotations.PatternsModule.u_dtype@1970-3.Invoke(FSharpFunc`2 env) in D:\a\_work\1\s\src\FSharp.Core\quotations.fs:line 1970
blazor.webassembly.js:1 at Microsoft.FSharp.Quotations.PatternsModule.u_VarDecl@2070.Invoke(BindingEnv env) in D:\a\_work\1\s\src\FSharp.Core\quotations.fs:line 2070
2blazor.webassembly.js:1 at Microsoft.FSharp.Quotations.PatternsModule.u_Expr@2048-2.Invoke(BindingEnv env) in D:\a\_work\1\s\src\FSharp.Core\quotations.fs:line 2048
blazor.webassembly.js:1 at Microsoft.FSharp.Quotations.PatternsModule.u_Expr@2059-5.Invoke(BindingEnv env) in D:\a\_work\1\s\src\FSharp.Core\quotations.fs:line 2059
blazor.webassembly.js:1 at Microsoft.FSharp.Quotations.PatternsModule.tryGetReflectedDefinition(MethodBase methodBase, Type[] tyargs) in D:\a\_work\1\s\src\FSharp.Core\quotations.fs:line 2542
blazor.webassembly.js:1 at Microsoft.FSharp.Quotations.PatternsModule.tryGetReflectedDefinitionInstantiated(MethodBase methodBase) in D:\a\_work\1\s\src\FSharp.Core\quotations.fs:line 2558
blazor.webassembly.js:1 at Microsoft.FSharp.Quotations.FSharpExpr.TryGetReflectedDefinition(MethodBase methodBase) in D:\a\_work\1\s\src\FSharp.Core\quotations.fs:line 2765
**Repro steps**
The whole project is sadly proprietary and all attempts to repoduce it in a smaller project failed so far.
I'm hoping someone can guess what this is without a repro but I'm still trying to find a minimal setup.
Edit: all trimming and AOT are disabled btw.
**Expected behavior**
Doesn't crash
**Actual behavior**
crashes in `Expr.TryGetReflectedDefinition`
**Known workarounds**
sadly none.
**Related information**
running on Blazor.WebAssembly with:
* `FSharp.Core 6.0.6`
* `Microsoft.AspNetCore.Components.WebAssembly 6.0.9`
Contributor guide
Assessment
This issue has not been assessed yet.