FileSystemGlobbing: Matcher throws ArgumentOutOfRangeException when the rootDir is the same value as the file
メンテナーはふだん 1 日以内に返信
評価
調査の方向性
まず src/libraries/Microsoft.Extensions.FileSystemGlobbing/src/InMemoryDirectoryInfo.cs、特に issue でリンクされている EnumerateFileSystemInfos のコードを確認してください。rootDir と file が同じパスになる、提供されたファイルベースのアプリで障害を再現し、その後、関連する FileSystemGlobbing のテストを調べてください。このケースで例外をスローせずに Match() が HasMatches == false を返せば完了です。
索引モデルが issue の本文から書いたものです。
説明
Description
See title and file-based app repro below.
Reproduction Steps
#:package [email protected]
using Microsoft.Extensions.FileSystemGlobbing;
var root = Path.GetPathRoot(Environment.CurrentDirectory)!;
var matcher = new Matcher();
matcher.AddInclude("MyFile.txt");
Console.WriteLine($"Match(rootDir: \"{root}\", file: \"{root}\")");
Console.WriteLine(matcher.Match(root, root).HasMatches);
Expected behavior
Match() returns a result with HasMatches == false and doesn't throw an exception.
I'm unsure whether it would/should be possible to setup a matcher which would match the path root.
Actual behavior
Match throws an exception:
Unhandled exception. System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than or equal to the size of the collection. (Parameter 'startIndex')
at System.String.IndexOfAny(Char[] anyOf, Int32 startIndex, Int32 count)
at Microsoft.Extensions.FileSystemGlobbing.InMemoryDirectoryInfo.EnumerateFileSystemInfos()+MoveNext()
at System.Collections.Generic.List`1.AddRange(IEnumerable`1 collection)
at Microsoft.Extensions.FileSystemGlobbing.Internal.MatcherContext.Match(DirectoryInfoBase directory, String parentRelativePath)
at Microsoft.Extensions.FileSystemGlobbing.Internal.MatcherContext.Execute()
at Microsoft.Extensions.FileSystemGlobbing.Matcher.Execute(DirectoryInfoBase directoryInfo)
at Microsoft.Extensions.FileSystemGlobbing.MatcherExtensions.Match(Matcher matcher, String rootDir, IEnumerable`1 files)
at Microsoft.Extensions.FileSystemGlobbing.MatcherExtensions.Match(Matcher matcher, String rootDir, String file)
at Program.<Main>$(String[] args)
Regression?
No
Known Workarounds
Check that rootDir != file before calling Match().
Configuration
Using 11.0.100-rc.3.26522.148 SDK to build. Unsure which runtime that means I am running.
Library version given in the sample.
Running on Ubuntu 24.04, x64.
I doubt the problem is configuration-specific, I believe it also repros on Windows.
Other information
- 主要言語
- C#
- スター
- 18.4k
- フォーク
- 5.8k
- 平均マージ
- 2日 17時間
- マージ済み PR(30日)
- 581
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
dotnet/runtime のほかの issue
-
DbTransaction.SupportsSavepoints docs say Release/ReleaseAsync are expected to throw, but they are no-ops by design対応中かも @alaricd が今日担当しました。 オープンarea-System.Transactions untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
dotnet/runtime#137040 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Configuration binder source generator emits unqualified List<T> when binding arrays without implicit usings対応中かも @makazeu が今日担当しました。 オープンarea-Extensions-Configuration bug source-generator
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
dotnet/runtime#136972 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[wasi] .NET 10: WasmEnableSIMD with AOT fails because WasiApp.targets has -msimd128 commented outオープンarea-Build-mono untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
PropertyChangedEventArgs should have a nice DebuggerDisplay対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンarea-System.ComponentModel untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
dotnet/runtime#136608 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
MemoryMappedFile (Windows): failed MEM_COMMIT is ignored, accessor over reserved memory crashes the process対応中かも @RutulPatel8 が 4 日前に担当しました。 オープンarea-System.IO bug untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
dotnet/runtime#136599 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
Bug: Needs Replicating
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
space-wizards/RobustToolbox#7189 ·
メンテナーはふだん 1 日以内に返信
-
enhancement needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
microsoft/microsoft-ui-reactor#1460 ·
メンテナーはふだん 1 日以内に返信
-
t/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
dotnet/maui#39950 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
The server's default HttpClient fails on plain http and on HTTPS servers without HTTP/2対応中かも @yasmoradi が今日担当しました。 オープンarea / templates
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
bitfoundation/bitplatform#14659 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
CommunityToolkit/Datasync#600 · コメント 1 件 ·