Jump to content

  • Log In with Google      Sign In   
  • Create Account


XNA Access Violation Exception


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 Phil123   Members   -  Reputation: 566

Like
0Likes
Like

Posted 30 April 2013 - 09:38 PM

System.AccessViolationException was unhandled
  Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
  Source=Microsoft.Xna.Framework
  StackTrace:
       at Microsoft.Xna.Framework.Audio.AudioCallbackDispatcher.IsEventRegistered(EventType type)
       at Microsoft.Xna.Framework.Audio.AudioCallbackDispatcher.UnregisterEvent(EventType type)
       at Microsoft.Xna.Framework.Audio.KernelMicrophone.ShutdownCaptureEngine()
       at Microsoft.Xna.Framework.Audio.MicrophoneUnsafeNativeMethods.ShutdownCaptureEngine()
       at Microsoft.Xna.Framework.Audio.AudioRendererShutdownHandler.AppExitingEventHandler(Object sender, EventArgs args)
  InnerException:
 

Every now and then, I get a System.AccessViolationException when closing the program and all the information I'm given is above.  I suppose it isn't really an issue as if the program crashes when I'm closing it, so it probably isn't the absolute end of the world (compared to it crashing during run time).  But I still would prefer for this to not happen.  Unfortunately, I don't know what's directly causing it, and I'm not sure it'd be helpful to post my audio manager classes either since the problem seems to be within the framework itself.

 

Any ideas?



Sponsor:

#2 phil_t   Crossbones+   -  Reputation: 3197

Like
0Likes
Like

Posted 30 April 2013 - 10:49 PM

Are you doing any multi-threading?



#3 Andy474   Members   -  Reputation: 651

Like
0Likes
Like

Posted 01 May 2013 - 01:34 AM

iirc a Sound effect must be properly disposed of when exiting.

 

So in the following Function (given to you by XNAs Game class:

 

private void UnloadContent(...)
{
    SoundEffect.Dispose();
}


#4 unbird   Crossbones+   -  Reputation: 4821

Like
0Likes
Like

Posted 01 May 2013 - 05:50 AM

Clicky!.

#5 Phil123   Members   -  Reputation: 566

Like
0Likes
Like

Posted 01 May 2013 - 09:19 AM

Are you doing any multi-threading?

 

Negative.

 

 

iirc a Sound effect must be properly disposed of when exiting.

 

So in the following Function (given to you by XNAs Game class:

 

 

private void UnloadContent(...)
{
    SoundEffect.Dispose();
}

 

Yeah, I'm still getting the same Access Violation Exception despite doing this on all of the sound/music content that's in the game.

 

 

Clicky!.

 

No luck with these solutions either. 



#6 VladR   Members   -  Reputation: 722

Like
0Likes
Like

Posted 01 May 2013 - 12:06 PM

As the error says, you cannot really do much. That is, unless you have relevant source codes (e.g. to XNA)

 

Yeah, it is annoying during debugging, but the end user will probably never experience it, unlike the poor dev who quits the game three hundred times during a weekend...

 

I can share what helped me to reduce the occurence to a minimum - Put a 3-second wait time before the game actually exits. This, most of the time, helps and it reduced the crashing from few hundred times to few tens for me...

 

Some people reportedly experienced another reduction of crashes when prolonging 3 seconds to 5. Didn't work for me, but you could try. 5 seconds, for me, is way too much time to wait till I can interact with Visual Studio...


VladR    My 3rd person action RPG on GreenLight:    http://steamcommunity.com/sharedfiles/filedetails/?id=92951596

 


#7 Phil123   Members   -  Reputation: 566

Like
0Likes
Like

Posted 01 May 2013 - 04:47 PM

Ack.  Well, I'm thinking of just running it without debugging, as most of the work I'm doing is tweaking (and not exception-fixing).  Thanks for the responses everyone.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS