Search Unity

Runtime Exception in Async Upload Pipeline when starting UWP Debugging

Discussion in 'Windows' started by stuey0016, Oct 28, 2020.

  1. stuey0016

    stuey0016

    Joined:
    Oct 6, 2012
    Posts:
    10
    Every time I try to start the debugger in Visual Studio to run a debug build of my game, I get an Access Violation Exception in Texture2D::UpdateFileTextureUploadInstruction(). Here's the stack:

    UnityPlayer.dll!Texture2D::UpdateFileTextureUploadInstruction(struct TextureUploadInstruction *,unsigned int)
    UnityPlayer.dll!Texture::InitializeFileTextureUploadInstruction(struct TextureUploadInstruction &,unsigned int,bool)
    UnityPlayer.dll!AsyncUploadTexture(class Texture &,unsigned int,bool)
    UnityPlayer.dll!Texture::BeginAsyncUpload(unsigned int,bool)
    UnityPlayer.dll!Texture2D::AwakeFromLoadThreaded(void)
    UnityPlayer.dll!PersistentManager::postReadActivationQueue(int,class TypeTree const *,bool,enum PersistentManager::LockFlags)
    UnityPlayer.dll!PersistentManager::ReadAndActivateObjectThreaded(int,struct SerializedObjectIdentifier const &,class SerializedFile *,bool,bool,enum PersistentManager::LockFlags)
    UnityPlayer.dll!PersistentManager::LoadFileCompletelyThreaded(class core::basic_string<char,class core::StringStorageDefault<char> > const &,__int64 *,int *,int,enum PersistentManager::LoadFlags,class LoadProgress &,enum PersistentManager::LockFlags)
    UnityPlayer.dll!LoadSceneOperation::perform(void)
    UnityPlayer.dll!PreloadManager::processSingleOperation(void)
    UnityPlayer.dll!PreloadManager::Run(void)
    UnityPlayer.dll!PreloadManager::Run(void *)
    UnityPlayer.dll!Thread::RunThreadWrapper(void *)
    kernel32.dll!00007ffa85ab7034()
    ntdll.dll!00007ffa864dcec1()

    I'm guessing this is part of the Async Upload Pipeline. This happens repeatedly, so I can't just skip it and keep going. The game runs when in release mode, but there are a few some performance issues I need to debug and profile.

    Is this a Unity bug or am I configuring something wrong? This is my first UWP project, so I'm admittedly new to these kinds of details. Also, is there a way around this? In my game, the player can essentially see the entire scene when a level loads, so I have very little need of AUP.

    Thanks in advance!
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Access violation in native engine code is almost always a bug in Unity, unless you run out of memory. Is there anything in game output that's worth attention prior to the crash?

    Debug mode is only useful if you want to step through C++ code with a debugger. For profiling and investigating performance issues you should use "Release build", which is equivalent to "Development build" in Windows Standalone player.
     
    MartinTilo likes this.
  3. stuey0016

    stuey0016

    Joined:
    Oct 6, 2012
    Posts:
    10
    Interesting...then my issues with connecting the Unity profiler to the Xbox must be some other connection-based problem. I appreciate the clarification on that. At least now I know what to focus on.

    There's really nothing in the game's output of any value, unfortunately. It happens before a singe frame is rendered. If you want to research it further, let me know and I'll send you what I can. But if I don't need to actually debug the UWP build in VS to run the profiler, this isn't as high a priority for me.

    And as always, thanks for the speedy and helpful response, @Tautvydas-Zilys!
     
  4. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    No problem! For profiler, make sure that the internet capabilities (internet client, internet client server and private networks) are enabled. That's the most common gotcha when profiler doesn't work on UWP.

    As for the crash: can we get a bug report on it?
     
    MartinTilo likes this.
  5. stuey0016

    stuey0016

    Joined:
    Oct 6, 2012
    Posts:
    10
    Ahhh, Private Networks...of course! Yes, that definitely solved the problem. I got the profiler working.

    Some interesting results...all the lag is in VSync calls, and specifically in Gfx.WaitForPresentOnGfxThread. And during some moments (possibly of lower CPU usage) those calls drop dramatically and the game returns to ~60 FPS (from maybe 4 or 5). I don't want to drag this thread outside the scope of the original post, though. I'm sure there are other threads out there, so I'll keep looking. Feels like a solvable problem, though.

    I'll make a bug report in Unity, though I've had trouble getting my project uploaded. Something always goes wrong. I'll try trimming some more unused assets...maybe getting the size down will help.

    Thanks, again!
     
  6. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    If you make a new thread about profiling, we can discuss that too. Also, I suggest using "Timeline" view of the profiler: you can then see what the graphics thread is doing while the main thread is waiting for it.
     
    MartinTilo likes this.