System.Reflection.AmbiguousMatchException from xaml in Windows Phone

Wednesday, September 3, 2014

Lately I ran into a tricky bug inside a Windows Phone application. Sometimes an unhandled exception was thrown that caused the application to crash. Looking into the logs showed that the exception was System.Reflection.AmbiguousMatchException which is caused when the reflection mechanism finds more than one option for a member in a class. TL;DR; – Don't bind in xaml to a property with new modifer  The reason for the exception was that one of the team members decided to derive a class from some entity - lets call the entity Person. public class Person { public int Age...

Dealing with reentrancy with DelegateCommand

Monday, May 19, 2014

many times in our application we have some button (or another command invoker) that is executing a long processing operation. today, with the power of Async Await its even easier to run these long operations while keeping the UI responsive. usually we will use some kind of DelegateCommand to bind our button to the ViewModels’ operation MissleLauncherView.xaml <Button  Command="{Binding LaunchMissiles, Mode=OneTime}"/>   MissleLauncherViewModel.cs private ICommand _launchMissilesCommand;public ICommand LaunchMissilesCommand {    get    {        return _ launchMissilesCommand ?? (_launchMissilesCommand = new DelegateCommand(           async (_) =>            {                await LaunchLongMissileAttack();            }));    } } this impose a very serious problem, while the LaunchLongMissileAttack method is working, nothing is preventing the command from being called again…and again…and again in...
no comments

How to solve CannotOpen exception when using SQLite after publishing WP8 application to the Store

Wednesday, January 8, 2014

Recently I experienced a weird behavior in a Windows Phone 8 application I'm working on. In the application, we are using SQLite for our local DB. Everything worked great in the emulator and when deployed to a device. BUT When we uploaded the app to the store for Beta testing we got an exception on the first operation we made to the DB. After looking at the logs (which isn't that easy after an app is installed by the store), we found that the exception message was “CannotOpen”. After searching this type of error we...
no comments