0

Has anyone heard of any issues with MessageDialog's not displaying on Windows 8 tablets? Or more specifically Samsung 700t? It uses a regular intel process and not ARM. I built the app on a laptop and the messagedialog shows when debugging from the laptop, shows on the tablet simulator but doesn't show on the actual tablet.

I'm using the Caliburn.Micro IResult interface to display the messagedialog in the view.

Heres snippits of code that I'm using:

public IEnumerable<IResult> NavExecute(String method)
{
    Windows.UI.ViewManagement.ApplicationView.TryUnsnap();
    var conn = NetworkInformation.GetInternetConnectionProfile();
    if (conn.GetNetworkConnectivityLevel() != NetworkConnectivityLevel.InternetAccess)
    {
        yield return new MessageDialogResult("Internet Connection Not Detected", "Connection Error");
        netOn = false;

    }

} the above is in my view model base class, and heres the implementation of the IResult class itself:

public class MessageDialogResult : ResultBase
{
    private readonly string _content;
    private readonly string _title;

    public MessageDialogResult(string content, string title)
    {
        _content = content;
        _title = title;
    }

    public async override void Execute(ActionExecutionContext context)
    {
        var dialog = new MessageDialog(_content, _title);

        await dialog.ShowAsync();

        OnCompleted();
    }
}

I doub't it's an issue with the code since I'm debugging in x86 mode on both devices (before anyone asks why I'm not debugging for all devices it's because I'm using SQLite which requires a seperate package for each arhitecture.)

I'm not sure if theres a setting somewhere in Windows 8 that disables in app popups, but I couldn't find one.

Any ideas?

Zach Johnson
  • 123
  • 9
  • Do you have another RT tablet you can use to try this on? Code looks ok to me, but could there be any throwing going on during `ShowAsync`? This would cause the coroutine to abort (it won't throw the exception any further, it just puts it in the result callback) – Charleh May 02 '13 at 15:12

2 Answers2

1

Are you handling the callback of Coroutine.Execute?

The callback on Execute might be calling back with an exception thrown by the coroutine - this would silently fail if you weren't explicitly looking for it in the callback

Coroutine.Execute(YourEnumerator(), new ActionExecutionContext { Blah }, (o, e) => {
    if(e.Error != null) // Something went wrong
});

Maybe the async await is throwing or something like that (can't think why!)

Edit:

Ah additionally stuff in your enumerator could also throw:

Windows.UI.ViewManagement.ApplicationView.TryUnsnap();
var conn = NetworkInformation.GetInternetConnectionProfile();

Either one could throw making the outer enumerator swallow an exception if not handled in the callback - or could be a nullref on conn?

Charleh
  • 13,749
  • 3
  • 37
  • 57
  • looks like your right, it doesn't like the GetInternetConnectionProfile() call, I'm also doing the same check on launch and it crashes on this piece if the device doesn't have internet access. It looks like it's crashing somewhere inside the GetInternetConnectionProfile() method. Debugging is a pain in the a** on this tablet with the screen being so small. Might be a hardware issue with the tablet, since it's running the same OS as the laptop. – Zach Johnson May 02 '13 at 15:43
  • Time for a high five? (and an upvote?) followed by a sad face :( – Charleh May 02 '13 at 15:45
  • I don't think it's an issue with the ennumerator so much because, when it fails in app.xaml.cs I'm not using an ennumerator, or even a messagedialog. Definitely something to do with getting the network info from the device. Thanks for leading me in the right direction! – Zach Johnson May 02 '13 at 15:46
  • If it's not returning anything from the `var conn = NetworkInformation.GetInternetConnectionProfile` call, then you have a null ref, but you don't null check before using it on the next line... – Charleh May 02 '13 at 15:47
  • Any idea what would cause it to come back with a null reference? And if it is indeed coming back with a null reference wouldn't it throw an exception when it evaluates conn in the if statement? It does do this when the app launches, but when it's being used in the enummerator it silently fails – Zach Johnson May 02 '13 at 15:51
  • 1
    No idea what would cause it - tbh I've never programmed for WinRT in my life :P just know CM quite well (and the CM codebase is shared). If it returns a null yes you will get a throw when used, but because the execution is wrapped in a CM `SequentialResult`, (this enumerates the enumerable and handles and exceptions) you won't see the exception. Instead `Couroutine` stops enumeration and immediately fires the callback passing the exception. This means that it can silently fail if you don't handle the callback - so this is what you are most likely experiencing – Charleh May 02 '13 at 16:02
1

The reason why GetInternetConnectionProfile() was returning a null ref was due to the fact that when on a laptop, if you disconnect from a wireless connection the laptop's internet connection profile defaults to ethernet, whereas the tablet (at least the Samsung 700T) doesn't have an ethernet port so it's connection profile doesn't exist if a wireless connection isn't established.

Thanks to Charleh for pointing me in the right direction.

Zach Johnson
  • 123
  • 9