Description
I've not been able to repro this issue easily in a minimal repo, but sometimes the FSharp intellisense still fails (after PR #9644 which fixed similar issues) with the same <Note>
:
The type 'IAsyncOperationWithProgress`2' is required here and is unavailable. You must add a reference to assembly 'Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null'.
This may happen if your project references packages that reference packages like System.Net.Http
which references System.Runtime.WindowsRuntime
. Even though WindowsRuntime package is referenced only on NetCore 5.0 (aka UAP10), it seems that it's still loaded to VS memory somehow.
Known workarounds
Try to avoid components that reference System.Runtime.WindowsRuntime
(with paket why
) and try to restrict what target-frameworks are used in loading those components.
Related information
Provide any related information (optional):
- Operating system Windows 11
- .NET Runtime kind (.NET Core, .NET Framework, Mono): .NET 7.0.101, Also .NET Framework 4.7.2.
- Editing Tools: Visual Studio 2022 v17.4.3, but happens also in VS Code.
Here is a stacktrace of intellisense when failing:
FSharp.Compiler.DiagnosticsLogger.ReportedError
HResult=0x80131500
Message=The exception has been reported. This internal exception should now be caught at an error recovery point on the stack. Original message: The type 'IAsyncOperationWithProgress`2' is required here and is unavailable. You must add a reference to assembly 'Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null'.)
Source=FSharp.Compiler.Service
StackTrace:
at FSharp.Compiler.DiagnosticsLogger.DiagnosticsLoggerExtensions.DiagnosticsLogger.Error[T](DiagnosticsLogger x, Exception exn) in D:\a\_work\1\s\src\Compiler\Facilities\DiagnosticsLogger.fs:line 448
FSharp.Compiler.Service.dll!FSharp.Compiler.DiagnosticsLogger.DiagnosticsLoggerExtensions.DiagnosticsLogger.Error<System.__Canon>(FSharp.Compiler.DiagnosticsLogger.DiagnosticsLogger x, System.Exception exn) Line 448
at D:\a\_work\1\s\src\Compiler\Facilities\DiagnosticsLogger.fs(448)
FSharp.Compiler.Service.dll!FSharp.Compiler.Import.ImportTypeRefData(FSharp.Compiler.Import.ImportMap env, FSharp.Compiler.Text.Range m, FSharp.Compiler.AbstractIL.IL.ILScopeRef scoref, string[] path, string typeName) Line 109
at D:\a\_work\1\s\src\Compiler\Checking\import.fs(109)
FSharp.Compiler.Service.dll!FSharp.Compiler.Import.ImportILTypeRefUncached(FSharp.Compiler.Import.ImportMap env, FSharp.Compiler.Text.Range m, FSharp.Compiler.AbstractIL.IL.ILTypeRef tref) Line 144
at D:\a\_work\1\s\src\Compiler\Checking\import.fs(144)
FSharp.Compiler.Service.dll!FSharp.Compiler.Import.ImportILTypeRef(FSharp.Compiler.Import.ImportMap env, FSharp.Compiler.Text.Range m, FSharp.Compiler.AbstractIL.IL.ILTypeRef tref) Line 154
at D:\a\_work\1\s\src\Compiler\Checking\import.fs(154)
FSharp.Compiler.Service.dll!FSharp.Compiler.Import.ImportILType(FSharp.Compiler.Import.ImportMap env, FSharp.Compiler.Text.Range m, Microsoft.FSharp.Collections.FSharpList<FSharp.Compiler.TypedTree.TType> tinst, FSharp.Compiler.AbstractIL.IL.ILType ty) Line 183
at D:\a\_work\1\s\src\Compiler\Checking\import.fs(183)
FSharp.Compiler.Service.dll!FSharp.Compiler.TypeHierarchy.ImportILTypeFromMetadataWithAttributes(FSharp.Compiler.Import.ImportMap amap, FSharp.Compiler.Text.Range m, FSharp.Compiler.AbstractIL.IL.ILScopeRef scoref, Microsoft.FSharp.Collections.FSharpList<FSharp.Compiler.TypedTree.TType> tinst, Microsoft.FSharp.Collections.FSharpList<FSharp.Compiler.TypedTree.TType> minst, FSharp.Compiler.AbstractIL.IL.ILType ilTy, Microsoft.FSharp.Core.FSharpFunc<Microsoft.FSharp.Core.Unit, FSharp.Compiler.AbstractIL.IL.ILAttributes> getCattrs) Line 354
at D:\a\_work\1\s\src\Compiler\Checking\TypeHierarchy.fs(354)
FSharp.Compiler.Service.dll!FSharp.Compiler.Infos.ILMethInfo.GetObjArgTypes(FSharp.Compiler.Import.ImportMap amap, FSharp.Compiler.Text.Range m, Microsoft.FSharp.Collections.FSharpList<FSharp.Compiler.TypedTree.TType> minst) Line 602
at D:\a\_work\1\s\src\Compiler\Checking\infos.fs(602)
FSharp.Compiler.Service.dll!FSharp.Compiler.Infos.MethInfo.GetObjArgTypes(FSharp.Compiler.Import.ImportMap amap, FSharp.Compiler.Text.Range m, Microsoft.FSharp.Collections.FSharpList<FSharp.Compiler.TypedTree.TType> minst) Line 1115
at D:\a\_work\1\s\src\Compiler\Checking\infos.fs(1115)
FSharp.Compiler.Service.dll!FSharp.Compiler.ConstraintSolver.IsApplicableMethApprox(FSharp.Compiler.TcGlobals.TcGlobals g, FSharp.Compiler.Import.ImportMap amap, FSharp.Compiler.Text.Range m, FSharp.Compiler.Infos.MethInfo minfo, FSharp.Compiler.TypedTree.TType availObjTy) Line 3732
at D:\a\_work\1\s\src\Compiler\Checking\ConstraintSolver.fs(3732)
FSharp.Compiler.Service.dll!<StartupCode$FSharp-Compiler-Service>.$FSharpCheckerResults.targets@518-2.Invoke(FSharp.Compiler.Infos.MethInfo arg30@, FSharp.Compiler.TypedTree.TType arg40@)
FSharp.Compiler.Service.dll!FSharp.Compiler.NameResolution.minfoFilter@3974-1.Invoke(FSharp.Compiler.Infos.MethInfo minfo) Line 4012
at D:\a\_work\1\s\src\Compiler\Checking\NameResolution.fs(4012)
FSharp.Core.dll!Microsoft.FSharp.Primitives.Basics.List.filterToFreshConsTail<FSharp.Compiler.Infos.MethInfo>(Microsoft.FSharp.Collections.FSharpList<FSharp.Compiler.Infos.MethInfo> cons, Microsoft.FSharp.Core.FSharpFunc<FSharp.Compiler.Infos.MethInfo, bool> f, Microsoft.FSharp.Collections.FSharpList<FSharp.Compiler.Infos.MethInfo> l) Line 476
at D:\a\_work\1\s\src\FSharp.Core\local.fs(476)
FSharp.Core.dll!Microsoft.FSharp.Primitives.Basics.List.filter<FSharp.Compiler.Infos.MethInfo>(Microsoft.FSharp.Core.FSharpFunc<FSharp.Compiler.Infos.MethInfo, bool> predicate, Microsoft.FSharp.Collections.FSharpList<FSharp.Compiler.Infos.MethInfo> l) Line 491
at D:\a\_work\1\s\src\FSharp.Core\local.fs(491)
FSharp.Compiler.Service.dll!FSharp.Compiler.NameResolution.minfos$cont@4038(FSharp.Compiler.NameResolution.ResolveCompletionTargets completionTargets, FSharp.Compiler.Text.Range m, FSharp.Compiler.AccessibilityLogic.AccessorDomain ad, bool statics, FSharp.Compiler.TypedTree.TType ty, FSharp.Compiler.TcGlobals.TcGlobals g, FSharp.Compiler.Import.ImportMap amap, Microsoft.FSharp.Collections.FSharpList<string> pinfoMethNames, Microsoft.FSharp.Collections.FSharpList<string> einfoMethNames, Microsoft.FSharp.Collections.FSharpList<FSharp.Compiler.NameResolution.Item> pinfoItems, Microsoft.FSharp.Collections.FSharpList<FSharp.Compiler.Infos.MethInfo> minfos, Microsoft.FSharp.Core.Unit unitVar) Line 4041
at D:\a\_work\1\s\src\Compiler\Checking\NameResolution.fs(4041)
FSharp.Compiler.Service.dll!FSharp.Compiler.NameResolution.f@129-12(FSharp.Compiler.NameResolution.NameResolver ncenv, FSharp.Compiler.NameResolution.NameResolutionEnv nenv, FSharp.Compiler.NameResolution.ResolveCompletionTargets completionTargets, FSharp.Compiler.Text.Range m, FSharp.Compiler.AccessibilityLogic.AccessorDomain ad, bool statics, FSharp.Compiler.TypedTree.TType ty, Microsoft.FSharp.Core.Unit unitVar0) Line 4036
at D:\a\_work\1\s\src\Compiler\Checking\NameResolution.fs(4036)
FSharp.Compiler.Service.dll!FSharp.Compiler.NameResolution.ResolveCompletionsInType(FSharp.Compiler.NameResolution.NameResolver ncenv, FSharp.Compiler.NameResolution.NameResolutionEnv nenv, FSharp.Compiler.NameResolution.ResolveCompletionTargets completionTargets, FSharp.Compiler.Text.Range m, FSharp.Compiler.AccessibilityLogic.AccessorDomain ad, bool statics, FSharp.Compiler.TypedTree.TType ty) Line 3897
at D:\a\_work\1\s\src\Compiler\Checking\NameResolution.fs(3897)
FSharp.Compiler.Service.dll!FSharp.Compiler.CodeAnalysis.TypeCheckInfo.GetPreciseItemsFromNameResolution<System.__Canon>(int line, int colAtEndOfNames, Microsoft.FSharp.Core.FSharpOption<System.__Canon> membersByResidue, FSharp.Compiler.NameResolution.TypeNameResolutionFlag filterCtors, FSharp.Compiler.CodeAnalysis.ResolveOverloads resolveOverloads) Line 520
at D:\a\_work\1\s\src\Compiler\Service\FSharpCheckerResults.fs(520)
FSharp.Compiler.Service.dll!FSharp.Compiler.CodeAnalysis.TypeCheckInfo.GetDeclaredItems<string>(Microsoft.FSharp.Core.FSharpOption<FSharp.Compiler.CodeAnalysis.FSharpParseFileResults> parseResultsOpt, string lineStr, Microsoft.FSharp.Core.FSharpOption<Microsoft.FSharp.Collections.FSharpList<string>> origLongIdentOpt, int colAtEndOfNamesAndResidue, Microsoft.FSharp.Core.FSharpOption<string> residueOpt, Microsoft.FSharp.Core.FSharpOption<int> lastDotPos, int line, int loc, FSharp.Compiler.NameResolution.TypeNameResolutionFlag filterCtors, FSharp.Compiler.CodeAnalysis.ResolveOverloads resolveOverloads, bool isInRangeOperator, Microsoft.FSharp.Core.FSharpFunc<Microsoft.FSharp.Core.Unit, Microsoft.FSharp.Collections.FSharpList<FSharp.Compiler.EditorServices.AssemblySymbol>> allSymbols) Line 928
at D:\a\_work\1\s\src\Compiler\Service\FSharpCheckerResults.fs(928)
FSharp.Compiler.Service.dll!FSharp.Compiler.CodeAnalysis.TypeCheckInfo.GetDeclItemsForNamesAtPosition(Microsoft.FSharp.Core.FSharpOption<FSharp.Compiler.CodeAnalysis.FSharpParseFileResults> parseResultsOpt, Microsoft.FSharp.Core.FSharpOption<Microsoft.FSharp.Collections.FSharpList<string>> origLongIdentOpt, Microsoft.FSharp.Core.FSharpOption<string> residueOpt, Microsoft.FSharp.Core.FSharpOption<int> lastDotPos, int line, string lineStr, int colAtEndOfNamesAndResidue, FSharp.Compiler.NameResolution.TypeNameResolutionFlag filterCtors, FSharp.Compiler.CodeAnalysis.ResolveOverloads resolveOverloads, Microsoft.FSharp.Core.FSharpOption<System.Tuple<FSharp.Compiler.Text.Position, Microsoft.FSharp.Core.FSharpOption<FSharp.Compiler.EditorServices.CompletionContext>>> completionContextAtPos, Microsoft.FSharp.Core.FSharpFunc<Microsoft.FSharp.Core.Unit, Microsoft.FSharp.Collections.FSharpList<FSharp.Compiler.EditorServices.AssemblySymbol>> getAllSymbols) Line 1396
at D:\a\_work\1\s\src\Compiler\Service\FSharpCheckerResults.fs(1396)
FSharp.Compiler.Service.dll!<StartupCode$FSharp-Compiler-Service>.$FSharpCheckerResults.GetDeclarations@1450.Invoke(Microsoft.FSharp.Core.Unit unitVar0) Line 1467
at D:\a\_work\1\s\src\Compiler\Service\FSharpCheckerResults.fs(1467)
FSharp.Compiler.Service.dll!FSharp.Compiler.Diagnostics.DiagnosticsScope.Protect<FSharp.Compiler.EditorServices.DeclarationListInfo>(FSharp.Compiler.Text.Range m, Microsoft.FSharp.Core.FSharpFunc<Microsoft.FSharp.Core.Unit, FSharp.Compiler.EditorServices.DeclarationListInfo> f, Microsoft.FSharp.Core.FSharpFunc<string, FSharp.Compiler.EditorServices.DeclarationListInfo> err) Line 145
at D:\a\_work\1\s\src\Compiler\Symbols\FSharpDiagnostic.fs(145)
FSharp.Compiler.Service.dll!FSharp.Compiler.CodeAnalysis.TypeCheckInfo.GetDeclarations(Microsoft.FSharp.Core.FSharpOption<FSharp.Compiler.CodeAnalysis.FSharpParseFileResults> parseResultsOpt, int line, string lineStr, FSharp.Compiler.EditorServices.PartialLongName partialName, Microsoft.FSharp.Core.FSharpOption<System.Tuple<FSharp.Compiler.Text.Position, Microsoft.FSharp.Core.FSharpOption<FSharp.Compiler.EditorServices.CompletionContext>>> completionContextAtPos, Microsoft.FSharp.Core.FSharpFunc<Microsoft.FSharp.Core.Unit, Microsoft.FSharp.Collections.FSharpList<FSharp.Compiler.EditorServices.AssemblySymbol>> getAllEntities) Line 1448
at D:\a\_work\1\s\src\Compiler\Service\FSharpCheckerResults.fs(1448)
FSharp.Editor.dll!<StartupCode$FSharp-Editor>.$CompletionProvider.ProvideCompletionsAsyncAux@106-6.Invoke(Microsoft.CodeAnalysis.Text.SourceText sourceText) Line 119
at D:\a\_work\1\s\vsintegration\src\FSharp.Editor\Completion\CompletionProvider.fs(119)
FSharp.Core.dll!Microsoft.FSharp.Control.AsyncPrimitives.AttachContinuationToUnitTask@1263.Invoke(System.Threading.Tasks.Task completedTask) Line 1264
at D:\a\_work\1\s\src\FSharp.Core\async.fs(1264)
mscorlib.dll!System.Threading.Tasks.Task.Execute() Line 2498
at f:\dd\ndp\clr\src\BCL\system\threading\Tasks\Task.cs(2498)
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Line 980
at f:\dd\ndp\clr\src\BCL\system\threading\executioncontext.cs(980)
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Line 928
at f:\dd\ndp\clr\src\BCL\system\threading\executioncontext.cs(928)
mscorlib.dll!System.Threading.Tasks.Task.ExecuteWithThreadLocal(ref System.Threading.Tasks.Task currentTaskSlot) Line 2827
at f:\dd\ndp\clr\src\BCL\system\threading\Tasks\Task.cs(2827)
mscorlib.dll!System.Threading.Tasks.Task.ExecuteEntry(bool bPreventDoubleExecution) Line 2767
at f:\dd\ndp\clr\src\BCL\system\threading\Tasks\Task.cs(2767)
mscorlib.dll!System.Threading.Tasks.TaskScheduler.TryRunInline(System.Threading.Tasks.Task task, bool taskWasPreviouslyQueued) Line 219
at f:\dd\ndp\clr\src\BCL\system\threading\Tasks\TaskScheduler.cs(219)
mscorlib.dll!System.Threading.Tasks.TaskContinuation.InlineIfPossibleOrElseQueue(System.Threading.Tasks.Task task, bool needsProtection) Line 263
at f:\dd\ndp\clr\src\BCL\system\threading\Tasks\TaskContinuation.cs(263)
mscorlib.dll!System.Threading.Tasks.Task.FinishContinuations() Line 3642
at f:\dd\ndp\clr\src\BCL\system\threading\Tasks\Task.cs(3642)
mscorlib.dll!System.Threading.Tasks.Task.Finish(bool bUserDelegateExecuted) Line 2253
at f:\dd\ndp\clr\src\BCL\system\threading\Tasks\Task.cs(2253)
mscorlib.dll!System.Threading.Tasks.Task.ExecuteWithThreadLocal(ref System.Threading.Tasks.Task currentTaskSlot) Line 2830
at f:\dd\ndp\clr\src\BCL\system\threading\Tasks\Task.cs(2830)
mscorlib.dll!System.Threading.Tasks.Task.ExecuteEntry(bool bPreventDoubleExecution) Line 2767
at f:\dd\ndp\clr\src\BCL\system\threading\Tasks\Task.cs(2767)
Microsoft.VisualStudio.Platform.VSEditor.dll!Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.Implementation.PrioritizedTaskScheduler.ThreadStart()
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Line 980
at f:\dd\ndp\clr\src\BCL\system\threading\executioncontext.cs(980)
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Line 928
at f:\dd\ndp\clr\src\BCL\system\threading\executioncontext.cs(928)
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) Line 917
at f:\dd\ndp\clr\src\BCL\system\threading\executioncontext.cs(917)
mscorlib.dll!System.Threading.ThreadHelper.ThreadStart() Line 111
at f:\dd\ndp\clr\src\BCL\system\threading\thread.cs(111)
Metadata
Metadata
Assignees
Type
Projects
Status