Вопрос

I have a few lines of code that have worked fine for months, and now suddenly they do not work and I get a very strange error. Here is the function in question:

public void OnCommandsRequested(SettingsPane settingsPane, SettingsPaneCommandsRequestedEventArgs eventArgs) {
        UICommandInvokedHandler handler = new UICommandInvokedHandler(OnSettingsCommand);
        SettingsCommand appSettings = new SettingsCommand("appSettings", "アプリ内設定", handler);
        eventArgs.Request.ApplicationCommands.Add(appSettings);
}

Naturally, this gets called in response to the SettingsPane.GetForCurrentView().CommandsRequested event. The error happens on the second line and is as follows:

A first chance exception of type 'System.FormatException' occurred in mscorlib.dll

Additional information: Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).

If I continue the app, then another exception comes:

A first chance exception of type 'System.InvalidCastException' occurred in mscorlib.dll

Additional information: Object in an IPropertyValue is of type 'String', which cannot be converted to a 'Guid'.

What is going on here? As you can see I'm not using any GUID values anywhere.

Это было полезно?

Решение

Although the documentation lists no restrictions, and all samples use strings, the first parameter is listed as taking Object - it's possible this now is simply set to require a giud.

Interestingly, it looks like this has been reported to Microsoft as a bug in the OS. No idea what the resolution is going to be.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top