我有几行代码可以运行好几个月,现在突然他们不工作,我得到一个非常奇怪的错误.这是有问题的功能:
public void OnCommandsRequested(SettingsPane settingsPane, SettingsPaneCommandsRequestedEventArgs eventArgs) { UICommandInvokedHandler handler = new UICommandInvokedHandler(OnSettingsCommand); SettingsCommand appSettings = new SettingsCommand("appSettings", "??????", handler); eventArgs.Request.ApplicationCommands.Add(appSettings); }
当然,这会响应SettingsPane.GetForCurrentView().CommandsRequested
事件而被调用.错误发生在第二行,如下所示:
mscorlib.dll中发生了'System.FormatException'类型的第一次机会异常
附加信息:Guid应包含32位数字和4个破折号(xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
如果我继续该应用程序,则会出现另一个异常:
mscorlib.dll中发生了'System.InvalidCastException'类型的第一次机会异常
附加信息:IPropertyValue中的对象是"String"类型,无法转换为"Guid".
这里发生了什么?正如您所看到的,我没有在任何地方使用任何GUID值.