skip to Main Content

I’m getting this error

error FS0073: internal error: tcrefOfAppTy (Failure) 

reported on this code

type ``Children``<'a> = abstract member ``Children`` : Unit -> 'a

[<Extension>]
type Extensions =
    [<Extension>]
    static member Children<'A, 'B when 'A :> ``Children``<'B>> (this: 'A) = 
        this.Children()

let f2 a =
    a.Children()

apologies for the strange code, this is part of a much much bigger project with literally hundreds if not thousands of types (I’m wondering if that’s the problem somehow)

This code DID used to compile on azure devops on a "windows-2019" box, with dotnet core 3.x, against F# 5.0

It doesnt compile (this project) on "windows-2022" box, since ive upgraded it to dotnetcore 6.0, F# 5, using a fake script. I notice the azure box uses visual studio enterprise

MSBuild version 17.3.0+f67e3d35e for .NET Framework

This code in this upgraded state, does compile in visual studio 2022, on my laptop, windows 11 pro.

And also the same fake script works, though my machine has this

Microsoft (R) Build Engine version 17.2.1+52cd2da31 for .NET Framework

and runs visual studio professional.

The devops logs contain this: (which looks a bit worrying)

Unhandled Exception: System.Exception: tcrefOfAppTy
2022-08-29T10:32:08.1995442Z             at FSharp.Compiler.TypedTreeOps.tcrefOfAppTy(TcGlobals g, TType ty) in D:a_work1ssrcCompilerTypedTreeTypedTreeOps.fs:line 877
2022-08-29T10:32:08.1997298Z             at FSharp.Compiler.AttributeChecking.CheckMethInfoAttributes[a](TcGlobals g, Range m, FSharpOption`1 tyargsOpt, MethInfo minfo) in D:a_work1ssrcCompilerCheckingAttributeChecking.fs:line 403
2022-08-29T10:32:08.1999466Z             at FSharp.Compiler.MethodCalls.MethInfoChecks[a](TcGlobals g, ImportMap amap, Boolean isInstance, FSharpOption`1 tyargsOpt, FSharpList`1 objArgs, AccessorDomain ad, Range m, MethInfo minfo) in D:a_work1ssrcCompilerCheckingMethodCalls.fs:line 1199
2022-08-29T10:32:08.2003101Z             at FSharp.Compiler.CheckExpressions.TcMethodApplication(Boolean isCheckingAttributeCall, TcFileState cenv, TcEnv env, UnscopedTyparEnv tpenv, FSharpOption`1 tyArgsOpt, FSharpList`1 objArgs, Range mMethExpr, Range mItem, String methodName, FSharpOption`1 objTyOpt, AccessorDomain ad, Mutates mut, Boolean isProp, FSharpList`1 calledMethsAndProps, AfterResolution afterResolution, ValUseFlag isSuperInit, FSharpList`1 curriedCallerArgs, OverallTy exprTy, FSharpList`1 delayed) in D:a_work1ssrcCompilerCheckingCheckExpressions.fs:line 9661
2022-08-29T10:32:08.2007667Z             at FSharp.Compiler.CheckExpressions.TcMethodApplicationThen(TcFileState cenv, TcEnv env, OverallTy overallTy, FSharpOption`1 objTyOpt, UnscopedTyparEnv tpenv, FSharpOption`1 callerTyArgs, FSharpList`1 objArgs, Range m, Range mItem, String methodName, AccessorDomain ad, Mutates mut, Boolean isProp, FSharpList`1 meths, AfterResolution afterResolution, ValUseFlag isSuperInit, FSharpList`1 args, ExprAtomicFlag atomicFlag, FSharpList`1 delayed) in D:a_work1ssrcCompilerCheckingCheckExpressions.fs:line 9169

and there’s little clue online about what the error means.

I think I’ll upgrade my laptop to the latest visual studio and see if it breaks!

(there are lots of variables here, I may boil this down to a much simpler project without thousands of types to see if i can isolate it, but at the moment I’m just looking for quick fixes/some educated guess as to what the cause is)

There is a similar issue reported on the compiler

https://github.com/dotnet/fsharp/issues/13525

that effects C# extension methods.

which is allegedly fixed (though which release I’m not sure), and in an associated issue there seems to be mention of dotnetcore 6.0.400, which both my laptop and my devops build are using.

2

Answers


  1. Chosen as BEST ANSWER

    I updated my laptop and dotnetcore 6.0.400 + visual studio 17.3.2 (i.e. MSBuild version 17.3.1+2badb37d1 for .NET Framework)

    does break in the same way.

    I may downgrade either my dotnet sdk or my visual studio

    I've logged it on the compiler github, allegedly its fixed in my case when vs is upgraded to 17.3.4.

    It also allegedly doesnt effect sdk builds on 6.0.302, but fake will use the vs msbuild in preference to the dsk build.


  2. I got the same problem. It seems that something got changed in dotnet 6.0.7 or 6.0.8 that broke it. Downgrading to 6.0.6 fixes problem for me.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search