c# - UWP navigation causing Access Viloation -


i converting wp 8.1 app uwp , interested in using prism thought build app ground up. have created page button navigates page, deployed app , gave go. when click button navigate following code executed

private void button1_click(object sender, routedeventargs e) {     this.frame.navigate(typeof(testpage)); } 

which crashes app. when @ output window in vs2015 see following @ bottom.

the program '[4760] myapp.exe' has exited code -1073741819 (0xc0000005) 'access violation'.

both pages have viewmodels , set using prisms viewmodellocator.autowireviewmodel. tried clearing properties of viewmodels empty no code did nothing. put breakpoint in view model constructor , reach point when debugging.

any ideas means or else look?

update: issue looks caused control template. narrowed issue down button control commenting out xaml , adding things 1 one. found control causing issue removed binding , style template. added binding , ok, added template , issue occurred.

you might need use dispatcher execute code on correct thread.

//initiate , set @ startup of app, on ui thread. dispatcher = windows.ui.core.corewindow.getforcurrentthread().dispatcher; 

then use dispatcher run code:

private async void button1_click(object sender, routedeventargs e) {     await dispatcher.runasync(coredispatcherpriority.normal, () =>             this.frame.navigate(typeof(testpage)); } 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -