There seem to be quite a few of exceptions coming out of FileSystemGlobbing, which is only used inside of LoadDirectoryFiles. Most frequent is an UnauthorizedAccessException:
at System.IO.Enumeration.FileSystemEnumerator`1.CreateDirectoryHandle(String path, Boolean ignoreNotFound)
at System.IO.Enumeration.FileSystemEnumerator`1..ctor(String directory, EnumerationOptions options)
at System.IO.Enumeration.FileSystemEnumerable`1..ctor(String directory, FindTransform transform, EnumerationOptions options)
at System.IO.Enumeration.FileSystemEnumerableFactory.FileSystemInfos(String directory, String expression, EnumerationOptions options)
at System.IO.DirectoryInfo.InternalEnumerateInfos(String path, String searchPattern, SearchTarget searchTarget, EnumerationOptions options)
at Microsoft.Extensions.FileSystemGlobbing.Abstractions.DirectoryInfoWrapper.EnumerateFileSystemInfos()+MoveNext()
at System.Collections.Generic.List`1.AddEnumerable(IEnumerable`1 enumerable)
at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)
at Microsoft.Extensions.FileSystemGlobbing.Internal.MatcherContext.Match(DirectoryInfoBase directory, S
But we also see DirectoryNotFoundException, IOException, PathTooLongException, and FileNotFoundException.
Right now, these exceptions during workspace/didChangeConfiguration go unhandled, produce an error message for the user via RPC, and record the exception.
Looking at the call site:
if (!_filesLoaded) {
await LoadDirectoryFiles();
}
_filesLoaded = true;
It may be better idea to do something on the order of:
if (!_filesLoaded) {
try {
await LoadDirectoryFiles();
_filesLoaded = true;
} catch (Exception ex) when (!ex.IsCriticalException()) {
// Log something to the user
}
}
That way, we don't record events that are really just errors in the user's configuration and also give feedback as to what's wrong.
There seem to be quite a few of exceptions coming out of
FileSystemGlobbing, which is only used inside ofLoadDirectoryFiles. Most frequent is anUnauthorizedAccessException:But we also see
DirectoryNotFoundException,IOException,PathTooLongException, andFileNotFoundException.Right now, these exceptions during
workspace/didChangeConfigurationgo unhandled, produce an error message for the user via RPC, and record the exception.Looking at the call site:
It may be better idea to do something on the order of:
That way, we don't record events that are really just errors in the user's configuration and also give feedback as to what's wrong.