配置系统错误和文件夹名称

发布于 2024-09-13 02:04:47 字数 747 浏览 2 评论 0原文

我刚刚解决了一个恼人的、极其顽固的错误,它让我挠头好几个小时。我将 C# (.Net Framework 2.0) 与内置设置结合使用,生成 XML 文件。这些设置运行得非常好......直到今天。 今天,每当我从 IDE 运行该程序时,它都会出现以下错误:

Configuration system failed to initialize.

Root element missing at (C:\Documents and Settings\... several directories in ... \ user.config)

我检查了它引用的文件夹,其中包含一长串看似随机的字符,但并不存在。我什至创建了它并用必要的 user.config 文件填充它,但无济于事。

最后,我更改了文件夹名称。我刚刚将该文件夹从 "NanoMETER#" 临时重命名为 "NanoMETE#"。它起作用了。

所以我放弃了修订,并将 R 添加回 “NanoMETE” 的末尾。它出错了。去掉R,就成功了。任何名为“NanoMETER#”的文件夹,同样,在尝试加载应用程序配置设置时都会崩溃。如果我将该文件夹命名为其他名称,效果会非常好。

我……我就是不明白。整个项目中没有任何地方引用了文件夹的名称,也没有在任何地方将 "NanoMETER#" 用作变量。有谁知道这可能是什么原因造成的?我完全被难住了。这可能是我在该项目中遇到的最WTF 的错误之一......

I just grappled with an annoying, extremely persistent bug that had me scratching my head for several hours. I'm using C# (.Net Framework 2.0) in conjunction with the built in Settings, which generates an XML file. The settings worked wonderfully... until today.
Today, whenever I ran the program from the IDE, it gave me this error:

Configuration system failed to initialize.

Root element missing at (C:\Documents and Settings\... several directories in ... \ user.config)

I checked the folder it referenced, which included a long string of seemingly random characters and didn't exist. I even went so far as to create it and populate it with the necessary user.config file, to no avail.

Eventually, I changed the folder name. I'd just renamed that folder from "NanoMETER#" to "NanoMETE#" temporarily. It worked.

So I got rid of the revision, and added the R back onto the end of "NanoMETE". It errored. Removed the R, it worked. Any folder named "NanoMETER#", exactly as such, crashes when it tries to load the application configuration settings. If I name the folder to anything else, it works beautifully.

I ... I just don't get it. Nowhere in the entire project is the name of the folder referenced, nor is "NanoMETER#" used as a variable anywhere. Does anyone have any idea what could have caused this? I'm just completely stumped. It's probably been one of the most WTF bugs I've had on the project...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

岁月静好 2024-09-20 02:04:47

该错误消息表明它实际上可以打开该文件,但随后发现该文件为空或已损坏。重命名文件夹可确保重新创建 user.config 文件,这确实可以解决问题。如果你找不到它,那么你的文件系统就出了问题。是时候运行彻底的磁盘扫描了。不太记得 XP 的情况了,chkdsk.exe 或 scandisk.exe 之类的。请访问 superuser.com 询问

The error message indicates that it can actually open the file, but then finds the file empty or corrupted. Renaming the folder ensures that the user.config file gets recreated, that will indeed solve the problem. If you can't find it back then there's something pretty icky going on with your file system. High time to run a thorough disk scan. Don't quite remember how for XP, chkdsk.exe or scandisk.exe, something like that. Ask at superuser.com

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文