问题
I'm working on a C# project for windows phone 8 that plays selected youtube videos.My app has 1 page, which has 3 Grids (1 for each of 3 States).
- Video Selection Menu (where I have an ItemsControl which has around 80-100 grids inside, where each of those grids has 2 textblocks, 1 image and a button inside them)
- Video Details Menu (Shows more info about the video the user selected on the "Video Selection Menu" and has a play button which gets you to the third State).
- Video (has a webbrowser control with the selected video)
Ok, about the problem now... When I have selected a video from State_1, then pressed play in State_2 that gets me to State_3 it's all ok. But when I go back to State_1 and start to scroll through the videos I get this exception: An unhandled exception of type 'System.OutOfMemoryException' occurred in System.Windows.ni.dll
Do you have any idea on what is the problem or how to fix this?
NOTE:
- Whenever a State changes I make
Visibility.Collapsed
the 2 other Grids andVisibility.Visible
the Grid that the State variable states. - When I don't have a webbrowser in the app (so no State_3) it works fine no problems. So my guess is that I need to disable the memory allocation of webbrowser when I'm not using it but not sure how.
Call Stack:
- > MyappName.DLL!MyappName.App.Application_UnhandledException(object sender, System.Windows.ApplicationUnhandledExceptionEventArgs e) Line 107 C#
Debugger.Break();
- System.Windows.ni.dll!MS.Internal.Error.CallApplicationUEHandler(System.Exception e) Unknown
- System.Windows.ni.dll!MS.Internal.JoltHelper.OnUnhandledException(object sender, System.UnhandledExceptionEventArgs args) Unknown
- [Native to Managed Transition]
- [Managed to Native Transition]
- System.Windows.ni.dll!MS.Internal.FrameworkCallbacks.NotifyManagedDebuggerOnNativeOOM() Unknown
来源:https://stackoverflow.com/questions/28199420/system-outofmemoryexception-unhandled-exception