Ric*_*dle 5 .net c# debugging exception
我的C#应用程序在抛出未处理的异常时向我发送一个堆栈跟踪,而我现在正在查看一个我不理解的异常.
看起来这不可能是我的错,但通常当我认为我后来被证明是错的时候.8-)这是堆栈跟踪:
mscorlib caused an exception (ArgumentOutOfRangeException): startIndex cannot be larger than length of string.
Parameter name: startIndex
System.String::InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy) + 6c
System.String::Substring(Int32 startIndex) + 0
System.IO.Directory::InternalGetFileDirectoryNames(String path, String userPathOriginal, String searchPattern, Boolean includeFiles, Boolean includeDirs, SearchOption searchOption) + 149
System.IO.Directory::GetFiles(String path, String searchPattern, SearchOption searchOption) + 1c
System.IO.Directory::GetFiles(String path) + 0
EntrianSourceSearch.Index::zz18ez() + 19b
EntrianSourceSearch.Index::zz18dz() + a
Run Code Online (Sandbox Code Playgroud)
所以我的代码(最后的混淆函数名称)调用System.IO.Directory.GetFiles(path)崩溃的字符串索引问题.
可悲的是,我不知道它的价值path是否已经传入,但不管怎样,当然不应该System.IO.Directory::GetFiles像那样崩溃?尝试我可能无法提出任何GetFiles重现崩溃的论据.
我是否真的在查看.NET运行时中的错误,或者是否有可能合法地导致此异常的内容?(如果在我调用时更改了目录,我可以理解出错的地方GetFiles,但在这种情况下我不希望出现字符串索引异常.)
编辑:感谢大家的想法!到目前为止最有可能的理论是,其中有一个带有狡猾的非BMP Unicode字符的路径名,但我仍然无法让它破裂.GetFiles使用Reflector 查看代码,我认为它可以破坏的唯一方法是GetDirectoryName()返回一个比其输入更长的路径,即使它的输入已经完全规范化.离奇.我已经尝试用非BMP字符制作路径名(我从来没有在8-之前有一个名为{MUSICAL SYMBOL G CLEF}的目录),但我仍然无法让它破裂.
我所做的是在失败的代码周围添加额外的日志记录(并确保我的日志记录与非BMP字符一起使用!).如果它再次发生,我会有更多的信息.
| 归档时间: |
|
| 查看次数: |
1571 次 |
| 最近记录: |