【发布时间】:2018-04-30 18:08:55
【问题描述】:
当我使用这样的网络路径构造一个新的 DirectoryInfo 时:
using Delimon.Win32.IO;
DirectoryInfo di = new DirectoryInfo(@"\\a\path\to\a\place\you\are\not\allowed\to\know")
我知道路径是正确的,因为当我复制粘贴时它会在我的浏览器中打开。但我收到一个错误:
“System.OverflowException:算术运算导致溢出。”
这是我能提供的所有调用堆栈信息。
System.OverflowException: Arithmetic operation resulted in an overflow.
at Delimon.Win32.IO.Helpers.GetFileInformation(String path)
at Delimon.Win32.IO.FileSystemInfo.Refresh()
at Delimon.Win32.IO.DirectoryInfo..ctor(String dir)
路径长度为 67 个字符。所以这条路并不长。
我找不到任何关于 System.OverflowException 的文档,该异常是由 DirectoryInfo 对象的构造引起的。
有什么帮助吗?
【问题讨论】:
-
您确定您使用的是斜杠而不是反斜杠吗?反斜杠应该被转义,以防万一。
-
如果不能发minimal reproducible example,看参考源和完整的调用栈是解决的办法。
-
好了,知道您使用的是
Delimon.Win32.IO.DirectoryInfo非常重要,这不是我们都知道和喜爱的System.IO.DirectoryInfo。这似乎是 rather old and unmaintained(也没有 NuGet 包),因此其中的任何错误都可能无法修复。 -
见gallery.technet.microsoft.com/…,你不是唯一一个有问题的人
-
听起来与stackoverflow.com/questions/33893164/… 相似,编辑:我一直忘记在 cmets 上输入提交……无论如何,这听起来像是您用来访问长文件名的库的问题,你确定你需要吗?