当我尝试设置Windows 8设置时,为什么会发生这种无关的错误?

bor*_*den 5 c# application-settings windows-runtime windows-8.1

我有几行代码可以运行好几个月,现在突然他们不工作,我得到一个非常奇怪的错误.这是有问题的功能:

public void OnCommandsRequested(SettingsPane settingsPane, SettingsPaneCommandsRequestedEventArgs eventArgs) {
        UICommandInvokedHandler handler = new UICommandInvokedHandler(OnSettingsCommand);
        SettingsCommand appSettings = new SettingsCommand("appSettings", "??????", handler);
        eventArgs.Request.ApplicationCommands.Add(appSettings);
}
Run Code Online (Sandbox Code Playgroud)

当然,这会响应SettingsPane.GetForCurrentView().CommandsRequested事件而被调用.错误发生在第二行,如下所示:

mscorlib.dll中发生了'System.FormatException'类型的第一次机会异常

附加信息:Guid应包含32位数字和4个破折号(xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).

如果我继续该应用程序,则会出现另一个异常:

mscorlib.dll中发生了'System.InvalidCastException'类型的第一次机会异常

附加信息:IPropertyValue中的对象是"String"类型,无法转换为"Guid".

这里发生了什么?正如您所看到的,我没有在任何地方使用任何GUID值.

Clo*_*use 4

尽管文档没有列出任何限制,并且所有示例都使用 strings,但第一个参数被列为 Take Object- 现在可能只是简单地设置为需要 giud 。

有趣的是,这似乎已作为操作系统中的错误报告给微软。不知道决议会是什么。