Skip to content

Latest dotnet (v9.0.301) breaks omnisharp #2676

@akarel-mb

Description

@akarel-mb

After updating to latest dotnet (v9.0.301 from v9.0.203), I am getting an exception on init: System.MissingMethodException: Method not found: 'System.ReadOnlySpan'1<Char> Microsoft.IO.Path.GetFileName(System.ReadOnlySpan'1<Char>)' for every project it attempts to load. Prior to the update omnisharp lsp was working as expected.

os: Windows 11
dotnet versoin: 9.0.301

Full stack trace:

Failed to load project file 'some-project-file.csproj'.
System.MissingMethodException: Method not found: 'System.ReadOnlySpan`1<Char> Microsoft.IO.Path.GetFileName(System.ReadOnlySpan`1<Char>)'.
   at Microsoft.Build.Shared.FileMatcher.IsFileNameMatch(String path, String pattern)
   at System.Linq.Enumerable.WhereListIterator`1.MoveNext()
   at Microsoft.Build.Shared.FileMatcher.<RemoveProjectDirectory>d__37.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Microsoft.Build.Shared.FileMatcher.GetFilesForStep(RecursiveStepResult stepResult, RecursionState recursionState, String projectDirectory, Boolean stripProjectDirectory)
   at Microsoft.Build.Shared.FileMatcher.GetFilesRecursive(ConcurrentStack`1 listOfFiles, RecursionState recursionState, String projectDirectory, Boolean stripProjectDirectory, IList`1 searchesToExclude, Dictionary`2 searchesToExcludeInSubdirs, TaskOptions taskOptions)
   at Microsoft.Build.Shared.FileMatcher.GetFilesImplementation(String projectDirectoryUnescaped, String filespecUnescaped, List`1 excludeSpecsUnescaped)
   at Microsoft.Build.Shared.FileMatcher.<>c__DisplayClass67_0.<GetFiles>b__1(String _)
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at Microsoft.Build.Shared.FileMatcher.GetFiles(String projectDirectoryUnescaped, String filespecUnescaped, List`1 excludeSpecsUnescaped)
   at Microsoft.Build.Internal.EngineFileUtilities.GetFileList(String directoryEscaped, String filespecEscaped, Boolean returnEscaped, Boolean forceEvaluateWildCards, IEnumerable`1 excludeSpecsEscaped, FileMatcher fileMatcher, Object loggingMechanism, IElementLocation includeLocation, IElementLocation excludeLocation, IElementLocation importLocation, BuildEventContext buildEventContext, String buildEventFileInfoFullPath, Boolean disableExcludeDriveEnumerationWarning)
   at Microsoft.Build.Evaluation.LazyItemEvaluator`4.IncludeOperation.SelectItems(Builder listBuilder, ImmutableHashSet`1 globsToIgnore)
   at Microsoft.Build.Evaluation.LazyItemEvaluator`4.LazyItemOperation.ApplyImpl(Builder listBuilder, ImmutableHashSet`1 globsToIgnore)
   at Microsoft.Build.Evaluation.LazyItemEvaluator`4.LazyItemOperation.Apply(Builder listBuilder, ImmutableHashSet`1 globsToIgnore)
   at Microsoft.Build.Evaluation.LazyItemEvaluator`4.LazyItemList.ComputeItems(LazyItemList lazyItemList, ImmutableHashSet`1 globsToIgnore)
   at Microsoft.Build.Evaluation.LazyItemEvaluator`4.LazyItemList.GetItemData(ImmutableHashSet`1 globsToIgnore)
   at Microsoft.Build.Evaluation.LazyItemEvaluator`4.LazyItemList.GetMatchedItems(ImmutableHashSet`1 globsToIgnore)
   at Microsoft.Build.Evaluation.LazyItemEvaluator`4.EvaluatorData.GetItems(String itemType)
   at Microsoft.Build.Evaluation.Expander`2.ItemExpander.ExpandExpressionCapture[S](Expander`2 expander, ItemExpressionCapture expressionCapture, IItemProvider`1 evaluatedItems, IElementLocation elementLocation, ExpanderOptions options, Boolean includeNullEntries, Boolean& isTransformExpression, List`1& itemsFromCapture)
   at Microsoft.Build.Evaluation.Expander`2.ItemExpander.ExpandExpressionCaptureIntoStringBuilder[S](Expander`2 expander, ItemExpressionCapture capture, IItemProvider`1 evaluatedItems, IElementLocation elementLocation, SpanBasedStringBuilder builder, ExpanderOptions options)
   at Microsoft.Build.Evaluation.Expander`2.ItemExpander.ExpandItemVectorsIntoString[T](Expander`2 expander, String expression, IItemProvider`1 items, ExpanderOptions options, IElementLocation elementLocation)
   at Microsoft.Build.Evaluation.Expander`2.ExpandIntoStringLeaveEscaped(String expression, ExpanderOptions options, IElementLocation elementLocation)
   at Microsoft.Build.Evaluation.ConditionEvaluator.ConditionEvaluationState`2.ExpandIntoStringBreakEarly(String expression)
   at Microsoft.Build.Evaluation.StringExpressionNode.EvaluatesToEmpty(IConditionEvaluationState state)
   at Microsoft.Build.Evaluation.MultipleComparisonNode.BoolEvaluate(IConditionEvaluationState state)
   at Microsoft.Build.Evaluation.OperatorExpressionNode.TryBoolEvaluate(IConditionEvaluationState state, Boolean& result)
   at Microsoft.Build.Evaluation.OrExpressionNode.BoolEvaluate(IConditionEvaluationState state)
   at Microsoft.Build.Evaluation.OperatorExpressionNode.TryBoolEvaluate(IConditionEvaluationState state, Boolean& result)
   at Microsoft.Build.Evaluation.OrExpressionNode.BoolEvaluate(IConditionEvaluationState state)
   at Microsoft.Build.Evaluation.OperatorExpressionNode.TryBoolEvaluate(IConditionEvaluationState state, Boolean& result)
   at Microsoft.Build.Evaluation.OrExpressionNode.BoolEvaluate(IConditionEvaluationState state)
   at Microsoft.Build.Evaluation.OperatorExpressionNode.TryBoolEvaluate(IConditionEvaluationState state, Boolean& result)
   at Microsoft.Build.Evaluation.OrExpressionNode.BoolEvaluate(IConditionEvaluationState state)
   at Microsoft.Build.Evaluation.OperatorExpressionNode.TryBoolEvaluate(IConditionEvaluationState state, Boolean& result)
   at Microsoft.Build.Evaluation.GenericExpressionNode.Evaluate(IConditionEvaluationState state)
   at Microsoft.Build.Evaluation.ConditionEvaluator.EvaluateConditionCollectingConditionedProperties[P,I](String condition, ParserOptions options, Expander`2 expander, ExpanderOptions expanderOptions, Dictionary`2 conditionedPropertiesTable, String evaluationDirectory, ElementLocation elementLocation, IFileSystem fileSystem, LoggingContext loggingContext, ProjectRootElementCacheBase projectRootElementCache)
   at Microsoft.Build.Evaluation.ConditionEvaluator.EvaluateCondition[P,I](String condition, ParserOptions options, Expander`2 expander, ExpanderOptions expanderOptions, String evaluationDirectory, ElementLocation elementLocation, IFileSystem fileSystem, LoggingContext loggingContext, ProjectRootElementCacheBase projectRootElementCache)
   at Microsoft.Build.Evaluation.LazyItemEvaluator`4.EvaluateCondition(String condition, ProjectElement element, ExpanderOptions expanderOptions, ParserOptions parserOptions, Expander`2 expander, LazyItemEvaluator`4 lazyEvaluator)
   at Microsoft.Build.Evaluation.LazyItemEvaluator`4.EvaluateConditionWithCurrentState(ProjectElement element, ExpanderOptions expanderOptions, ParserOptions parserOptions)
   at Microsoft.Build.Evaluation.Evaluator`4.EvaluateItemElement(Boolean itemGroupConditionResult, ProjectItemElement itemElement, LazyItemEvaluator`4 lazyEvaluator)
   at Microsoft.Build.Evaluation.Evaluator`4.EvaluateItemGroupElement(ProjectItemGroupElement itemGroupElement, LazyItemEvaluator`4 lazyEvaluator)
   at Microsoft.Build.Evaluation.Evaluator`4.Evaluate()
   at Microsoft.Build.Evaluation.Evaluator`4.Evaluate(IEvaluatorData`4 data, Project project, ProjectRootElement root, ProjectLoadSettings loadSettings, Int32 maxNodeCount, PropertyDictionary`1 environmentProperties, ICollection`1 propertiesFromCommandLine, ILoggingService loggingService, IItemFactory`2 itemFactory, IToolsetProvider toolsetProvider, IDirectoryCacheFactory directoryCacheFactory, ProjectRootElementCacheBase projectRootElementCache, BuildEventContext buildEventContext, ISdkResolverService sdkResolverService, Int32 submissionId, EvaluationContext evaluationContext, Boolean interactive)
   at Microsoft.Build.Evaluation.Project.ProjectImpl.Reevaluate(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext)
   at Microsoft.Build.Evaluation.Project.ProjectImpl.ReevaluateIfNecessary(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext)
   at Microsoft.Build.Evaluation.Project.ProjectImpl.ReevaluateIfNecessary(EvaluationContext evaluationContext)
   at Microsoft.Build.Evaluation.Project.ProjectImpl.Initialize(IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext, Boolean interactive)
   at Microsoft.Build.Evaluation.Project..ctor(String projectFile, IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectCollection projectCollection, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext, IDirectoryCacheFactory directoryCacheFactory, Boolean interactive)
   at Microsoft.Build.Evaluation.ProjectCollection.LoadProject(String fileName, IDictionary`2 globalProperties, String toolsVersion)
   at OmniSharp.MSBuild.ProjectLoader.EvaluateProjectFileCore(String filePath, IReadOnlyDictionary`2 projectConfigurationsInSolution, IList`1 loggers) in D:\\a\\1\\s\\src\\OmniSharp.MSBuild\\ProjectLoader.cs:line 160
   at OmniSharp.MSBuild.ProjectLoader.BuildProject(String filePath, IReadOnlyDictionary`2 configurationsInSolution) in D:\\a\\1\\s\\src\\OmniSharp.MSBuild\\ProjectLoader.cs:line 84
   at OmniSharp.MSBuild.ProjectFile.ProjectFileInfo.Load(String filePath, ProjectIdInfo projectIdInfo, ProjectLoader loader, Guid sessionId, DotNetInfo dotNetInfo) in D:\\a\\1\\s\\src\\OmniSharp.MSBuild\\ProjectFile\\ProjectFileInfo.cs:line 117
   at OmniSharp.MSBuild.ProjectManager.<>c__DisplayClass32_0.<LoadProject>b__0() in D:\\a\\1\\s\\src\\OmniSharp.MSBuild\\ProjectManager.cs:line 305
   at OmniSharp.MSBuild.ProjectManager.LoadOrReloadProject(String projectFilePath, Func`1 loader) in D:\\a\\1\\s\\src\\OmniSharp.MSBuild\\ProjectManager.cs:line 316

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions