WordPress database error: [INSERT, UPDATE command denied to user '51213-2'@'10.10.20.25' for table 'wp_options']INSERT INTO `wp_options` (`option_name`, `option_value`, `autoload`) VALUES ('_transient_doing_cron', '1715228622.9995739459991455078125', 'yes') ON DUPLICATE KEY UPDATE `option_name` = VALUES(`option_name`), `option_value` = VALUES(`option_value`), `autoload` = VALUES(`autoload`)
I am talking about this kind of error messages : βException thrown at 0x77694598 (KernelBase.dll) in MonAppli.Windows.exe: 0x40080201: WinRT originate error (parameters: 0x80072F19, 0x00000067, 0x0519EE60).β I looked for every hexadecomal code without success.
To get the message associated with this error, follow this procedure :
Not really obvious but this works fine
If you want to see this feature in action, it will soon be available in our last app “Say it With Flowers” !
PS: the whole procedure is describe in depth on MSDN but I am sure you love this recap
PS2: the localized app name won’t be displayed on the Store page because of a bug in the Store : http://blog.webrox.fr/?p=61
]]>This is quite boring because it also raises the SelectionChanged event twice and can mess up your business logic.
Let’s see how to fix this temporary (I hope!) issue :
The problem is that the LongListMultiSelector listen to the changes(add/remove/replace/clear) in it’s SelectedItem collection so we can’t use it directly.
The solution is to ‘fake’ an user selection using the LongListMultiSelectorItem which is the container of each item.
So instead of writing this code :
[csharp]
foreach (var item in LongListMultiSelector.ItemsSource)
{
//LongListMultiSelector.SelectedItems.Add(item);
}
[/csharp]
you have to write this code :
[csharp]
foreach (var item in LongListMultiSelector.ItemsSource)
{
var container = LongListMultiSelector.ContainerFromItem(item)
as LongListMultiSelectorItem;
if (container != null) container.IsSelected = true;
}
[/csharp]
Yesterday, while I was updating my ConsoTracker app, I met a strange bug using the CustomMessageBox : it was raising a nullReference exception.
Let’s see what was the issue and how to “fix” it.
What I was trying to do was this simple scenario :
As I like playing with tasks, I was using this code :
[csharp]
protected async override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
var mBox = new CustomMessageBox
{
Title = "Do you want to… ",
Message = " … click on yes ?",
LeftButtonContent = "Yes",
RightButtonContent = "No"
};
var result = await ShowAsync(mBox);
NavigationService.Navigate(new Uri("/OtherPage.xaml", UriKind.RelativeOrAbsolute));
}
public static async Task<CustomMessageBoxResult> ShowAsync(CustomMessageBox box)
{
var taskCompletionSource = new TaskCompletionSource<CustomMessageBoxResult>();
box.Dismissed += (a, b) => taskCompletionSource.TrySetResult(b.Result);
try { box.Show(); }
catch (Exception exception) { taskCompletionSource.TrySetException(exception); }
return await taskCompletionSource.Task;
}
[/csharp]
This code was throwing an exception. To fix it, I downloaded the source of the Windows Phone Toolkit and I saw that at the end of the dismissal animation, it was trying to access the “Popup” object which was null : BOUM !
So… how did I fix it ? Simply by waiting for the popup to be unloaded instead of using directly the Dismissed event of the CustomMessageBox :
[csharp]
public static async Task<CustomMessageBoxResult> ShowAsync(CustomMessageBox box)
{
var taskCompletionSource = new TaskCompletionSource<CustomMessageBoxResult>();
var result = CustomMessageBoxResult.None;
//Only store the result here.
box.Dismissed += (a, b) => result = b.Result;
//Use this event to set the result.
box.Unloaded += (_, __) => taskCompletionSource.TrySetResult(result);
try { box.Show(); }
catch (Exception exception) { taskCompletionSource.TrySetException(exception); }
return await taskCompletionSource.Task;
}
[/csharp]
I hope it will save you some time too
]]>