OutOfMemoryException on application load

1

This error is driving me crazy. I have this app made with c# and It was working fine a few days ago, but ever since I installed the .net native preview it starts as a background process and works until it gets to: MainWindow mainWindow = new MainWindow(); that's when it stops executing code.. after a few seconds it vanishes from task manager and writes this to the event log:

Faulting application name: CryptoLight.exe, version: 1.0.0.0, time stamp: 0x54233e4c Faulting module name: KERNELBASE.dll, version: 6.3.9600.17055, time stamp: 0x532943a3 Exception code: 0xe0434352 Fault offset: 0x00011d4d Faulting process ID: 0xce8 Faulting application start time: 0x01cfd8428be7903d Faulting application path: C:\Users\<Name>\Documents\Visual Studio 2013\Projects\CompleteCryptography\CompleteCryptography\bin\Release\CryptoLight.exe Faulting module path: C:\WINDOWS\SYSTEM32\KERNELBASE.dll Report ID: cf371a9b-4435-11e4-bef6-6894233c343e Faulting package full name: Faulting package-relative application ID:

or this:

Application: CryptoLight.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.OutOfMemoryException Stack: at MS.Internal.Resources.ResourceManagerWrapper.GetStream(System.String) at MS.Internal.AppModel.ResourcePart.EnsureResourceLocationSet() at MS.Internal.AppModel.ResourcePart.GetContentTypeCore() at System.IO.Packaging.PackagePart.get_ContentType() at System.Windows.Application.LoadComponent(System.Object, System.Uri) at CryptoLight.MainWindow.InitializeComponent() at CryptoLight.App.App_Startup(System.Object, System.Windows.StartupEventArgs) at System.Windows.Application.OnStartup(System.Windows.StartupEventArgs) at System.Windows.Application.<.ctor>b__1(System.Object) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32) at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)

earlier today (the first time I experienced this problem) I got a Fatal CLR Error: 80004005 upon starting the application, I think I've fixed it by removing duplicate .net installations but this problem started right after that..

EDIT: after some more debugging I have finally found the line of code that causes this error: InitializeComponent(); in MainWindow(). why is InitializeComponent(); causing a OutOfMemoryException, I get this exception when my app is only using 45 - 50 mb and I have around 3 gb ram free out of 4 gb on a 64bit pc

c#
.net
wpf
asked on Stack Overflow Sep 24, 2014 by javaseaayameradost • edited Nov 19, 2018 by DividedByZero

3 Answers

1

I'm sorry, but I can give you just a hint, nothing complete.. I'm writing it as an answer ,because it's quite long and won't fit in comments. But still may help..

fact: except for some rare cases, many .Net versions can coexist on a single system. If installing a new version of the framework breaks your app - that may mean that your app was "opened for updates" and it picked the newest framework instead of sticking to the one it was built for.

hint #1: you can create a "manifest" file (i.e. app.exe.manifest) and inside you can state which framework versions are allowed to be used. So, i.e. on a system with Net4 you can force an app to run on Net2.0 level. I can't provide you with the syntax.. but it's easy to find on the internet.

hint #2: in case of very dark cases, you can enable pre-startup logging. .Net uses "Fusion engine" for determining which framework DLLs should be used, and this engine is fired off before the application actually runs. Fusion checks what you have in the system, checks app's requirements (i.e. manifest) and tries to bind everything together. You can turn on "fusion logging", then run the app, then turn logging off and check the logs to learn what exactly DLLs were selected for your assembly. Helpful if wrong ones are picked and you don't know why. Just don't forget to turn the logging off, as it slows down the startup of all .Net applications :)

answered on Stack Overflow Sep 25, 2014 by quetzalcoatl
1

It was a problem with the .net framework that's comes with windows, I think the .net native preview was messing with it. A system restore solved the problem

answered on Stack Overflow Sep 25, 2014 by javaseaayameradost
0

Did you install Visual Studio for .NET Native Preview? I think it comes with latest CLR. It is possible that we accidentally introduced a regression in that CLR. Please file a bug on Microsoft Connect and send me a link to it (karel.zikmund@you-know-where.com).

Please provide your clr.dll version in your bug report:

filever /v %WINDIR%\Microsoft.NET\Framework\v4.0.30319\clr.dll (grab the FileVersion string)

Also please add to the bug a dump from your application crash (attach VS as native debugger).

-Karel Zikmund (developer on CLR /.NET Native reliability team)

answered on Stack Overflow Oct 2, 2014 by Karel Zikmund

User contributions licensed under CC BY-SA 3.0