Question

The program '[3188] Sprudelsuche.WP.exe' has exited with code -1073741819 (0xc0000005) 'Access violation'.

This is the last line in Output, before that I get

'Sprudelsuche.WP.exe' (CoreCLR: .): Loaded 'C:\windows\system32\en-US\mscorlib.debug.resources.dll'. Module was built without symbols. [Caliburn.Micro.View] ERROR: System.NullReferenceException: Object reference not set to an instance of an object. at Caliburn.Micro.View.SetContentPropertyCore(Object targetLocation, Object view)

Effect is that app shows splash briefly, then closes immediately.

The application in question is on GitHub at https://github.com/christophwille/Sprudelsuche/blob/master/Source/Sprudelsuche.WP/App.xaml.cs - the reason I started trying DisplayRootView is that DisplayRootViewFor doesn't work with navigation later in the app (MainViewModel/NavigateTo: Output shows it is activating the new view model, but the view never comes up).

I use CM in a WP8 SL app with no issues whatsover. However, this has me stumped as I didn't deviate much from the CM samples in this very simple port. (btw, NavigateToViewModel exhibits the same issue)

Bootnote: I noticed a interesting tidbit in the source code for DisplayRootView - handling of the frame after navigation compared to DisplayRootViewFor. Also, in the Hub the convention based binding didn't work for me. I sure am doing something wrong...

Was it helpful?

Solution 2

In writing comments to mvermef's answer I started trying out copying code to a blank project / using a different view for startup. As this worked a-ok, my remark "binding doesn't work" reminded me that I tried a hell lot of different approaches to make it work, and lo and behold, one of those had remained in the source code:

<Hub Header="spritpreise">
            <HubSection Header="SUCHE">
                <DataTemplate>
                    <Grid caliburn:View.Model="{Binding}">

The AV crash was caused by the last line. Turning it back into a Grid without the CM-VM-binding made the app work. Funny though that this only crashes View-first, and not ViewModel-first.

OTHER TIPS

look at your line of code in PrepareViewFirst(Frame rootFrame)

you have

 protected override void PrepareViewFirst(Frame rootFrame)
 {
   container.RegisterNavigationService(this.RootFrame);
 }

it probably should be

protected override void PrepareViewFirst(Frame rootFrame)
{
  container.RegisterNaviationService(rootFrame);
}

then

DisplayRootView<MainView>(); 

should work just fine;

edit: try moving PrepareViewFirst() method to the bottom of the Configure override. There are 2 PrepareViewFirst() methods one parameterized and the other not... use the un-param'd method in Configure(), comment out the call in OnLaunched();

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top