I only saw this error a single time and have no way to reproduce so the error report will be a little short on information, sorry. I'll add more information if it reproduce.
So yesterday this build server was updated to VS 15.9.5 (From VS 15.9.0 or something, without reboot if it's important) and this morning during a build it failed with an internal F# compiler error.
One thing to point about this server is that it has multiple build agents so might have been doing other builds in parallel for other projects/branches (Not that it should crash the compiler...)
Can't reproduce it, re-running the build on the same commit succeeded and other builds on the same server before and after too.
The build works consistently
Build stopped with error:
Unhandled Exception: System.InvalidCastException: Unable to cast object of type 'Microsoft.FSharp.Collections.FSharpList`1[Microsoft.FSharp.Compiler.NameResolution+ExtensionMember]' to type 'FSExtMem'.
Unhandled Exception: System.InvalidCastException: Unable to cast object of type 'Microsoft.FSharp.Collections.FSharpList`1[Microsoft.FSharp.Compiler.NameResolution+ExtensionMember]' to type 'FSExtMem'.
at Microsoft.FSharp.Compiler.NameResolution.ExtensionMember.Hash(ExtensionMember e1)
at Microsoft.FSharp.Compiler.NameResolution.Comparer@296-1.System-Collections-Generic-IEqualityComparer`1-GetHashCode(ExtensionMember x)
at System.Collections.Generic.HashSet`1.InternalGetHashCode(T item)
at System.Collections.Generic.HashSet`1.AddIfNotPresent(T value)
at Microsoft.FSharp.Compiler.NameResolution.SelectMethInfosFromExtMembers@1966.GenerateNext(IEnumerable`1& next)
at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1.MoveNextImpl()
at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1.System-Collections-IEnumerator-MoveNext()
at Microsoft.FSharp.Collections.SeqModule.ToList[T](IEnumerable`1 source)
at Microsoft.FSharp.Compiler.NameResolution.ExtensionMethInfosOfTypeInScope(InfoReader infoReader, NameResolutionEnv nenv, FSharpOption`1 optFilter, range m, TType ty)
at Microsoft.FSharp.Compiler.NameResolution.ResolveLongIdentInTypePrim(NameResolver ncenv, NameResolutionEnv nenv, LookupKind lookupKind, ResolutionInfo resInfo, Int32 depth, range m, AccessorDomain ad, Ident id, FSharpList`1 rest, FindMemberFlag findFlag, TypeNameResolutionInfo typeNameResInfo, TType ty)
at Microsoft.FSharp.Compiler.NameResolution.ResolveLongIdentInTyconRef(NameResolver ncenv, NameResolutionEnv nenv, LookupKind lookupKind, ResolutionInfo resInfo, Int32 depth, range m, AccessorDomain ad, Ident id, FSharpList`1 rest, TypeNameResolutionInfo typeNameResInfo, EntityRef tcref)
at Microsoft.FSharp.Compiler.NameResolution.ResolveLongIdentInTyconRefs@2224.Invoke(Tuple`2 tupledArg)
at Microsoft.FSharp.Compiler.NameResolution.CollectAtMostOneResult[a,b](FSharpFunc`2 f, FSharpList`1 _arg1)
at Microsoft.FSharp.Compiler.NameResolution.CollectResults2@935.Invoke(FSharpList`1 _arg1)
at Microsoft.FSharp.Compiler.NameResolution.AtMostOneResultQuery[a](FSharpFunc`2 query2, ResultOrException`1 res1)
at Microsoft.FSharp.Compiler.NameResolution.ResolveExprLongIdentPrim(TcResultsSink sink, NameResolver ncenv, Boolean first, FullyQualifiedFlag fullyQualified, range m, AccessorDomain ad, NameResolutionEnv nenv, TypeNameResolutionInfo typeNameResInfo, Ident id, FSharpList`1 rest, Boolean isOpenDecl)
at Microsoft.FSharp.Compiler.NameResolution.ResolveExprLongIdent(TcResultsSink sink, NameResolver ncenv, range m, AccessorDomain ad, NameResolutionEnv nenv, TypeNameResolutionInfo typeNameResInfo, FSharpList`1 lid)
at Microsoft.FSharp.Compiler.NameResolution.ResolveLongIdentAsExprAndComputeRange(TcResultsSink sink, NameResolver ncenv, range wholem, AccessorDomain ad, NameResolutionEnv nenv, TypeNameResolutionInfo typeNameResInfo, FSharpList`1 lid)
at Microsoft.FSharp.Compiler.TypeChecker.TcLongIdentThen(cenv cenv, TType overallTy, TcEnv env, SyntacticUnscopedTyparEnv tpenv, LongIdentWithDots _arg4, FSharpList`1 delayed)
at Microsoft.FSharp.Compiler.TypeChecker.TcExpr(cenv cenv, TType ty, TcEnv env, SyntacticUnscopedTyparEnv tpenv, SynExpr expr)
at Microsoft.FSharp.Compiler.ErrorLogger.ErrorLoggerExtensions.ReraiseIfWatsonable(Exception exn)
at Microsoft.FSharp.Compiler.ErrorLogger.ErrorLoggerExtensions.ErrorLogger.ErrorRecovery(ErrorLogger x, Exception exn, range m)
at Microsoft.FSharp.Compiler.TypeChecker.TcExpr(cenv cenv, TType ty, TcEnv env, SyntacticUnscopedTyparEnv tpenv, SynExpr expr)
at Microsoft.FSharp.Compiler.TypeChecker.TcExprThatCantBeCtorBody(cenv cenv, TType overallTy, TcEnv env, SyntacticUnscopedTyparEnv tpenv, SynExpr expr)
at Microsoft.FSharp.Compiler.TypeChecker.f@506-18(cenv cenv, FSharpOption`1 safeThisValOpt, SafeInitData safeInitInfo, SynExpr rhsExpr, TType overallExprTy, SyntacticUnscopedTyparEnv tpenv, TcEnv envinner, Boolean isCtor, Unit unitVar0)
at Microsoft.FSharp.Compiler.TypeChecker.TcNormalizedBinding(DeclKind declKind, cenv cenv, TcEnv env, SyntacticUnscopedTyparEnv tpenv, TType overallTy, FSharpOption`1 safeThisValOpt, SafeInitData safeInitInfo, FSharpList`1 enclosingDeclaredTypars, ExplicitTyparInfo _arg9, NormalizedBinding bind)
at Microsoft.FSharp.Compiler.TypeChecker.TcNonRecursiveBinding(DeclKind declKind, cenv cenv, TcEnv env, SyntacticUnscopedTyparEnv tpenv, TType ty, SynBinding b)
at [email protected](SyntacticUnscopedTyparEnv tpenv, SynBinding b)
at Microsoft.FSharp.Primitives.Basics.List.mapFold[TState,T,TResult](FSharpFunc`2 f, TState acc, FSharpList`1 xs)
at Microsoft.FSharp.Compiler.TypeChecker.TcLetBinding(cenv cenv, Boolean isUse, TcEnv env, ContainerInfo containerInfo, DeclKind declKind, SyntacticUnscopedTyparEnv tpenv, FSharpList`1 binds, range bindsm, range scopem)
at Microsoft.FSharp.Compiler.TypeChecker.TcLetBindings(cenv cenv, TcEnv env, ContainerInfo containerInfo, DeclKind declKind, SyntacticUnscopedTyparEnv tpenv, FSharpList`1 binds, range bindsm, range scopem)
at Microsoft.FSharp.Compiler.TypeChecker.MutRecBindingChecking.TcMutRecBindings_Phase2B_TypeCheckAndIncrementalGeneralization@13421-2.Invoke(Tuple`7 innerState, TyconBindingPhase2A defnA)
at Microsoft.FSharp.Primitives.Basics.List.mapFoldToFreshConsTail[TResult,TState,T](FSharpList`1 cons, FSharpFunc`3 f, TState acc, FSharpList`1 xs)
at Microsoft.FSharp.Primitives.Basics.List.mapFold[TState,T,TResult](FSharpFunc`2 f, TState acc, FSharpList`1 xs)
at Microsoft.FSharp.Compiler.TypeChecker.MutRecBindingChecking.TcMutRecBindings_Phase2B_TypeCheckAndIncrementalGeneralization@13374.Invoke(Tuple`5 outerState, TcEnv envForDecls, MutRecShape`5 defnsA)
at Microsoft.FSharp.Compiler.TypeChecker.MutRecShapes.mapFoldWithEnv@3619.Invoke(a z, MutRecShape`5 x)
at Microsoft.FSharp.Primitives.Basics.List.mapFold[TState,T,TResult](FSharpFunc`2 f, TState acc, FSharpList`1 xs)
at Microsoft.FSharp.Collections.ListModule.MapFold[T,TState,TResult](FSharpFunc`2 mapping, TState state, FSharpList`1 list)
at Microsoft.FSharp.Compiler.TypeChecker.MutRecBindingChecking.TcMutRecBindings_Phase2B_TypeCheckAndIncrementalGeneralization(cenv cenv, SyntacticUnscopedTyparEnv tpenv, TcEnv envInitial, TcEnv envMutRec, FSharpList`1 defnsAs, FSharpList`1 uncheckedRecBinds, range scopem)
at Microsoft.FSharp.Compiler.TypeChecker.MutRecBindingChecking.TcMutRecDefns_Phase2_Bindings(cenv cenv, TcEnv envInitial, SyntacticUnscopedTyparEnv tpenv, range bindsm, range scopem, FSharpOption`1 mutRecNSInfo, TcEnv envMutRecPrelimWithReprs, FSharpList`1 mutRecDefns)
at Microsoft.FSharp.Compiler.TypeChecker.TcMutRecDefns_Phase2(cenv cenv, TcEnv envInitial, range bindsm, range scopem, FSharpOption`1 mutRecNSInfo, TcEnv envMutRec, FSharpList`1 mutRecDefns)
at Microsoft.FSharp.Compiler.ErrorLogger.ErrorLoggerExtensions.ReraiseIfWatsonable(Exception exn)
at Microsoft.FSharp.Compiler.ErrorLogger.ErrorLoggerExtensions.ErrorLogger.ErrorRecovery(ErrorLogger x, Exception exn, range m)
at Microsoft.FSharp.Compiler.TypeChecker.TcMutRecDefns_Phase2(cenv cenv, TcEnv envInitial, range bindsm, range scopem, FSharpOption`1 mutRecNSInfo, TcEnv envMutRec, FSharpList`1 mutRecDefns)
at Microsoft.FSharp.Compiler.TypeChecker.TcDeclarations.TcMutRecDefinitions(cenv cenv, TcEnv envInitial, ParentRef parent, FSharpSet`1 typeNames, SyntacticUnscopedTyparEnv tpenv, range m, range scopem, FSharpOption`1 mutRecNSInfo, FSharpList`1 mutRecDefns)
at Microsoft.FSharp.Compiler.TypeChecker.TcModuleOrNamespaceElementNonMutRec@16782-1.Invoke(Unit unitVar)
at Microsoft.FSharp.Compiler.AbstractIL.Internal.Library.EventuallyModule.catch@877-1.Invoke(CompilationThreadToken ctok)
at Microsoft.FSharp.Compiler.ErrorLogger.ErrorLoggerExtensions.ReraiseIfWatsonable(Exception exn)
at Microsoft.FSharp.Compiler.ErrorLogger.ErrorLoggerExtensions.ErrorLogger.ErrorRecovery(ErrorLogger x, Exception exn, range m)
at Microsoft.FSharp.Compiler.TypeChecker.TcModuleOrNamespaceElementNonMutRec@16781-19.Invoke(Exception _arg3)
at Microsoft.FSharp.Compiler.AbstractIL.Internal.Library.EventuallyModule.bind@868-1.Invoke(CompilationThreadToken ctok)
at Microsoft.FSharp.Compiler.AbstractIL.Internal.Library.EventuallyModule.bind@868-1.Invoke(CompilationThreadToken ctok)
at Microsoft.FSharp.Compiler.AbstractIL.Internal.Library.EventuallyModule.bind@868-1.Invoke(CompilationThreadToken ctok)
at Microsoft.FSharp.Compiler.AbstractIL.Internal.Library.EventuallyModule.catch@877-1.Invoke(CompilationThreadToken ctok)
at Microsoft.FSharp.Compiler.ErrorLogger.ErrorLoggerExtensions.ReraiseIfWatsonable(Exception exn)
at Microsoft.FSharp.Compiler.ErrorLogger.ErrorLoggerExtensions.ErrorLogger.ErrorRecovery(ErrorLogger x, Exception exn, range m)
at Microsoft.FSharp.Compiler.TypeChecker.TcModuleOrNamespaceElementNonMutRec@16781-19.Invoke(Exception _arg3)
at Microsoft.FSharp.Compiler.AbstractIL.Internal.Library.EventuallyModule.bind@868-1.Invoke(CompilationThreadToken ctok)
at Microsoft.FSharp.Compiler.AbstractIL.Internal.Library.EventuallyModule.bind@868-1.Invoke(CompilationThreadToken ctok)
at Microsoft.FSharp.Compiler.AbstractIL.Internal.Library.EventuallyModule.bind@868-1.Invoke(CompilationThreadToken ctok)
at Microsoft.FSharp.Compiler.AbstractIL.Internal.Library.EventuallyModule.bind@868-1.Invoke(CompilationThreadToken ctok)
at Microsoft.FSharp.Compiler.AbstractIL.Internal.Library.EventuallyModule.catch@877-1.Invoke(CompilationThreadToken ctok)
at Microsoft.FSharp.Compiler.ErrorLogger.ErrorLoggerExtensions.ReraiseIfWatsonable(Exception exn)
at Microsoft.FSharp.Compiler.ErrorLogger.ErrorLoggerExtensions.ErrorLogger.ErrorRecovery(ErrorLogger x, Exception exn, range m)
at Microsoft.FSharp.Compiler.CompileOps.TypeCheckOneInputEventually@5414-8.Invoke(Exception _arg4)
at Microsoft.FSharp.Compiler.AbstractIL.Internal.Library.EventuallyModule.forceWhile[a](CompilationThreadToken ctok, FSharpFunc`2 check, Eventually`1 e)
at Microsoft.FSharp.Compiler.AbstractIL.Internal.Library.EventuallyModule.force[a](CompilationThreadToken ctok, Eventually`1 e)
at Microsoft.FSharp.Compiler.CompileOps.TypeCheckOneInput(CompilationThreadToken ctok, FSharpFunc`2 checkForErrors, TcConfig tcConfig, TcImports tcImports, TcGlobals tcGlobals, FSharpOption`1 prefixPathOpt, TcState tcState, ParsedInput inp)
at Microsoft.FSharp.Compiler.CompileOps.TypeCheckClosedInputSet@5559.Invoke(TcState tcState, ParsedInput inp)
at Microsoft.FSharp.Primitives.Basics.List.mapFoldToFreshConsTail[TResult,TState,T](FSharpList`1 cons, FSharpFunc`3 f, TState acc, FSharpList`1 xs)
at Microsoft.FSharp.Primitives.Basics.List.mapFold[TState,T,TResult](FSharpFunc`2 f, TState acc, FSharpList`1 xs)
at Microsoft.FSharp.Compiler.CompileOps.TypeCheckClosedInputSet(CompilationThreadToken ctok, FSharpFunc`2 checkForErrors, TcConfig tcConfig, TcImports tcImports, TcGlobals tcGlobals, FSharpOption`1 prefixPathOpt, TcState tcState, FSharpList`1 inputs)
at Microsoft.FSharp.Compiler.Driver.TypeCheck(CompilationThreadToken ctok, TcConfig tcConfig, TcImports tcImports, TcGlobals tcGlobals, ErrorLogger errorLogger, String assemblyName, NiceNameGenerator niceNameGen, TcEnv tcEnv0, FSharpList`1 inputs, Exiter exiter)
at Microsoft.FSharp.Compiler.ErrorLogger.ErrorLoggerExtensions.ReraiseIfWatsonable(Exception exn)
at Microsoft.FSharp.Compiler.ErrorLogger.ErrorLoggerExtensions.ErrorLogger.ErrorRecovery(ErrorLogger x, Exception exn, range m)
at Microsoft.FSharp.Compiler.Driver.TypeCheck(CompilationThreadToken ctok, TcConfig tcConfig, TcImports tcImports, TcGlobals tcGlobals, ErrorLogger errorLogger, String assemblyName, NiceNameGenerator niceNameGen, TcEnv tcEnv0, FSharpList`1 inputs, Exiter exiter)
at Microsoft.FSharp.Compiler.Driver.main0[a](a ctok, String[] argv, Resolver legacyReferenceResolver, Boolean bannerAlreadyPrinted, ReduceMemoryFlag reduceMemoryUsage, CopyFSharpCoreFlag defaultCopyFSharpCore, Exiter exiter, ErrorLoggerProvider errorLoggerProvider, DisposablesTracker disposables)
at Microsoft.FSharp.Compiler.Driver.typecheckAndCompile(CompilationThreadToken ctok, String[] argv, Resolver legacyReferenceResolver, Boolean bannerAlreadyPrinted, ReduceMemoryFlag reduceMemoryUsage, CopyFSharpCoreFlag defaultCopyFSharpCore, Exiter exiter, ErrorLoggerProvider loggerProvider, FSharpOption`1 tcImportsCapture, FSharpOption`1 dynamicAssemblyCreator)
at Microsoft.FSharp.Compiler.CommandLineMain.Driver.main(String[] argv)
at Microsoft.FSharp.Compiler.CommandLineMain.main(String[] argv)
at Microsoft.FSharp.Compiler.ErrorLogger.ErrorLoggerExtensions.ReraiseIfWatsonable(Exception exn)
at Microsoft.FSharp.Compiler.ErrorLogger.ErrorLoggerExtensions.ErrorLogger.ErrorRecovery(ErrorLogger x, Exception exn, range m)
at Microsoft.FSharp.Compiler.CommandLineMain.main(String[] argv)
Re-running the build ?
Provide any related information
Maybe you can paste the full exception stack trace? At least that should show the location of the error.
@abelbraaksma The exception message is a <detail> block, if you click on it it give the stacktrace
@vbfox I'll tag this as needs-repro for now. The code in the stack trace doesn't look particularly offensive, but there may well be some issue in there.
@vbfox, oh cool, I didn't know that feature, and I didn't see it on my mobile, now I do :)
@vbfox Has this reproduced for you aside from the time you experienced it?
No, it seem that the error never occurred again after this point (The server has been restarted & VS updated a few times since then)
@vbfox Thanks! I'll close this out for now!
Most helpful comment
@abelbraaksma The exception message is a
<detail>block, if you click on it it give the stacktrace