Debugging an issue

Hi everyone
i’m at the end of my nerves trying to debug an issue i’m having.
Neither the visual studio nor the isolated storage can direct me towards the problem.

The game starts and runs fine but after coming back to the xaml menu and trying to start up the level again the game crashes.

Here’s how i load the level:

if (new Random().Next(0, 2) > 0)
                    LevelManagement.nextLevel = "Level";
                else
                    LevelManagement.nextLevel = "Level2";

                if (MainPage.IsLoaded)
                {
                    UnityApp.BeginInvoke(() => LevelManagement.LoadLevel("Loading"));
                }
                NavigationService.Navigate( new Uri( "/MainPage.xaml", UriKind.Relative ) );

So basically what this should do is load the game from start (loading is the first level loaded because it’s the first level listed in build settings) the first time and the second time explicitly load the level named loading

The Visual studio output:

EXITED FROM PAUSE
True
Level: 1
The program '[3924] TaskHost.exe' has exited with code -1073741819 (0xc0000005) 'Access violation'.

Also the UnityPlayer.log

Build from '' branch, version is '4.2.0f4 (38efbd14869d)' (Release build).
Physical memory: 898 MB, commited memory limit: 380 MB.
PlayerConnection initialized from C:/Data/Programs/{30900437-510C-442C-AF04-822815B0C5D0}/Install/Data (debug = 0)
PlayerConnection initialized network socket : 0.0.0.0 55062
Multi-casting "[IP] 127.0.0.1 [Port] 55062 [Flags] 2 [Guid] 16711253 [EditorId] 2246646999 [Version] 1048832 [Id] WP8Player(0.0.0.0) [Debug] 0" to [225.0.0.222:54997]...
Direct3D:
    Version:  Direct3D 11.0 [level 9.3]
    Renderer: Qualcomm Adreno 225 (WDDM v1.2) (ID=0x32303032)
    Vendor:   Qualcomm
    VRAM:     96 MB
Initialize engine version: 4.2.0f4 (38efbd14869d)
Changed Orientation to: LandscapeLeft
 
(Filename: C:/BuildAgent/work/cac08d8a5e25d4cb/Runtime/ExportGenerated/WP8Support/UnityEngineDebug.cpp Line: 63)

BaseObject: NotAvailableDuringDebugging
 
(Filename: C:/BuildAgent/work/cac08d8a5e25d4cb/Runtime/ExportGenerated/WP8Support/UnityEngineDebug.cpp Line: 63)

Unloading 3 Unused Serialized files (Serialized files now loaded: 0 / Dirty serialized files: 0)

Unloading 3 unused Assets to reduce memory usage. Loaded Objects now: 285. Operation took 69.035263 ms.
System memory in use: 2.2 MB.
UnloadTime: 2.454666 ms

Unloading 13 unused Assets to reduce memory usage. Loaded Objects now: 13879. Operation took 658.736145 ms.
System memory in use: 35.1 MB.
UnloadTime: 407.508881 ms


Unloading 398 unused Assets to reduce memory usage. Loaded Objects now: 13936. Operation took 942.062073 ms.
System memory in use: 35.3 MB.

Direct3D:
    Version:  Direct3D 11.0 [level 9.3]
    Renderer: Qualcomm Adreno 225 (WDDM v1.2) (ID=0x32303032)
    Vendor:   Qualcomm
    VRAM:     96 MB

Can anyone point me to the right direction on how i should debug this?
Is it perhaps using too much memory the second time it loads?
My unity version is 4.2.0f4

Thanks in advance

I traced the problem down to this line

UnityApp.BeginInvoke(() => LevelManagement.LoadLevel("Loading"));

Where the app stops

Looks like you’re initializing Unity twice in the exported project. You shouldn’t do that and it will not work.

Thanks for the input.

If i call UnityApp.Pause somewhere, i cannot find a way to unpause app accordingly and i’m not able to call unity functions while it’s paused.
Instead i tried using Obscure and Unobscure and it works so far. Not sure about the drawbacks tho.

Obscure and unobscure are the correct functions to use. You shouldn’t touch pause :).