FileSystemGlobbing: Matcher throws ArgumentOutOfRangeException when the rootDir is the same value as the file
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 78/100
Línea de trabajo
Empieza por src/libraries/Microsoft.Extensions.FileSystemGlobbing/src/InMemoryDirectoryInfo.cs, especialmente el código de EnumerateFileSystemInfos enlazado en el issue. Reproduce el fallo con la aplicación proporcionada basada en archivos, donde rootDir y file son la misma ruta, y luego revisa las pruebas relacionadas de FileSystemGlobbing. El trabajo estará terminado cuando Match() devuelva HasMatches == false sin lanzar una excepción en este caso.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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
- Lenguaje dominante
- C#
- Estrellas
- 18.4k
- Forks
- 5.8k
- Merge medio
- 2 d 17 h
- PR fusionados (30 d)
- 581
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de dotnet/runtime
-
DbTransaction.SupportsSavepoints docs say Release/ReleaseAsync are expected to throw, but they are no-ops by designPosiblemente ocupada @alaricd la tomó hace 1 día. Abiertoarea-System.Transactions untriaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
dotnet/runtime#137040 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Configuration binder source generator emits unqualified List<T> when binding arrays without implicit usingsPosiblemente ocupada @makazeu la tomó hace 1 día. Abiertoarea-Extensions-Configuration bug source-generator
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
dotnet/runtime#136972 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[wasi] .NET 10: WasmEnableSIMD with AOT fails because WasiApp.targets has -msimd128 commented outAbiertoarea-Build-mono untriaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
PropertyChangedEventArgs should have a nice DebuggerDisplayPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertoarea-System.ComponentModel untriaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
dotnet/runtime#136608 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
MemoryMappedFile (Windows): failed MEM_COMMIT is ignored, accessor over reserved memory crashes the processPosiblemente ocupada @RutulPatel8 la tomó hace 5 días. Abiertoarea-System.IO bug untriaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
dotnet/runtime#136599 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de dotnet/runtime
Issues similares
-
needs-triage
Dificultad 1/5 1-3 horas Aptitud para principiantes 76/100
Azure/azure-sdk-for-net#64658 · 1 comentario · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
dotnet/aspnetcore#70370 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
NethermindEth/nethermind#15684 ·
Los mantenedores suelen responder en 1 día
-
area/ai-assistant squad/flyt
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
Altinn/altinn-studio#21798 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
SubtitleEdit/subtitleedit#16699 ·
Los mantenedores suelen responder en 1 día