.Net Windows Service Crashes with MSVCR120_CLR0400.dll exception - c#

We have a windows service in production server which is Windows Server 2008 r2 standard and installed .net framework version 4.5.2 in it.
Service stopped twice in last one week suddenly with below event viewer sourced exception :
Event Id :1026 , .net runtime exception:
Application: XXX.Application.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException
Stack:
at System.Buffer.__Memcpy(Byte*, Byte*, Int32)
at System.Buffer.__Memcpy(Byte*, Byte*, Int32)
at System.Buffer._Memcpy(Byte*, Byte*, Int32)
at System.Buffer.Memcpy(Byte*, Byte*, Int32)
at System.String.ToCharArray()
at FluentValidation.Internal.Extensions+<>c__DisplayClassd`2[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Nullable`1[[System.Decimal, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].<CoerceToNonGeneric>b__c(System.Object)
at FluentValidation.Validators.PropertyValidatorContext.get_PropertyValue()
at FluentValidation.Validators.AbstractComparisonValidator.IsValid(FluentValidation.Validators.PropertyValidatorContext)
at FluentValidation.Validators.PropertyValidator.Validate(FluentValidation.Validators.PropertyValidatorContext)
at FluentValidation.Internal.PropertyRule+<Validate>d__8.MoveNext()
at System.Linq.Enumerable+<SelectManyIterator>d__14`2[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].MoveNext()
at System.Collections.Generic.List`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]..ctor(System.Collections.Generic.IEnumerable`1<System.__Canon>)
at System.Linq.Enumerable.ToList[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
at FluentValidation.AbstractValidator`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Validate(FluentValidation.ValidationContext`1<System.__Canon>)
Event ID :1000
Faulting application name: XX.Application.exe, version: 2.1.0.5017, time stamp: 0x59b1865e
Faulting module name: MSVCR120_CLR0400.dll, version: 12.0.51209.34209, time stamp: 0x5348a2f4
Exception code: 0xc0000005
Fault offset: 0x0000000000001630
Faulting process id: 0x12a8
Faulting application start time: 0x01d3307a3a9dca66
Faulting application path: XX.Application.exe
Faulting module path: C:\Windows\system32\MSVCR120_CLR0400.dll
Report Id: 5ea7c0b6-a0f0-11e7-8d71-0050568c317d
I've googled for a week but couldn't get any answer.
Would you please help me about what could be the problem with our windows service or what should I do to find problem ?
Thanks.

After I posted this question, we realized that we had compiled code with x86 run platform from teamcity before we publish code to server. After that publish, this problem occurred.But we should have done this publish with x64 platform because our server is 64 bit.
After realizing that, we get publish packages again from Visual Studio with Release Mode and Mixed Platform setted.
For two weeks, problem never happened again ,so I wanted to share that solution.
In conclusion, It was because our publish package's run platform confusion. If you ever come up to that problem may be you should check your publish packages run platform.

Your code probably deals incorrectly with Enumerables. To find the root cause I suggest subscribing to unhanded exception and write as much details as you can to logs:
public static void Start() {
AppDomain currentDomain = AppDomain.CurrentDomain;
currentDomain.UnhandledException += new UnhandledExceptionEventHandler(currentDomain_UnhandledException);
running = true;
ThreadStart ts = new ThreadStart(ServiceThreadBody);
thread = new Thread(ts);
thread.Name = "ServiceThread";
thread.Priority = ThreadPriority.BelowNormal;
thread.Start();
}

Related

Task Scheduler Fails .Net 4.5 Console Application

I have a .Net 4.5 Console Application written in C# that makes a call to SQL using Entity Framework 6.1.3 and generates a PDF. The application runs fine if you run the executable but it fails when ran through Task Scheduler. It will only run on Task Scheduler with option "Run only when user is logged in" I need it to run when not logged in.
What I did to test the executable in Task Scheduler was to mock the data gets called from Entity Framework and the application worked just fine so something tells me that Task Scheduler did not like my Entity Framework call. Yet I have other Schedule Tasks Running using Entity Framework.. Not sure what the problem is. Below is one the error seen in Windows Log.
Application: CreatePDFFile.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Data.SqlClient.SqlException
Stack:
at System.Data.Entity.Internal.RetryAction1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].PerformAction(System.__Canon)
at System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(System.Action1)
at System.Data.Entity.Internal.LazyInternalContext.InitializeDatabase()
at System.Data.Entity.Internal.LazyInternalContext.get_ObjectContext()
at System.Data.Entity.Internal.InternalContext.ExecuteSqlQuery[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.String, System.Nullable1<Boolean>, System.Object[])
at System.Data.Entity.Internal.InternalContext.ExecuteSqlQueryAsIEnumerator[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.String, System.Nullable1, System.Object[])
at System.Data.Entity.Internal.InternalContext.ExecuteSqlQuery(System.Type, System.String, System.Nullable1<Boolean>, System.Object[])
at System.Data.Entity.Internal.InternalSqlNonSetQuery.GetEnumerator()
at System.Data.Entity.Infrastructure.DbRawSqlQuery1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].GetEnumerator()
at System.Linq.Enumerable+WhereSelectEnumerableIterator2[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].MoveNext()
at System.Collections.Generic.List1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]..ctor(System.Collections.Generic.IEnumerable1<System.__Canon>)
at System.Linq.Enumerable.ToList[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.Collections.Generic.IEnumerable1)
at Repository.MyRepository.GetData(System.String, System.String, System.String, Int32)
I am using SQL Authentication. I added a try catch error and I get this:
Login failed: The login is from an untrusted domain and cannot be used
with Windows Authentication.
After looking at my connection string, I realized that I had copied the connectionstring from my PC to the server and replaced the data source but not the credentials....So its resolved.

The program '[13476] MyApp.vshost.exe' has exited with code -1 (0xffffffff)

I have a project with Output Type of Console Application that sometimes fails to start up when I debug. When this happens, may app starts to run and write to the vshost.exe console that is hosting the process being debugged. Then all of a sudden I will see a message in the Output window that says something like "The program '[13476] MyApp.vshost.exe' has exited with code -1 (0xffffffff)."
It doesn't happen every time, but when it does the Console Window my app started up in freezes on the screen and the debugger seems to halt. However, the vshost.exe process does not actually stop (I can see it in Task Manager with the same Process ID as the error message). It is as if Visual Studio thinks the process has exited, but it really has not. When I stop the debugger, the console window remains frozen on the screen as well. The only way to get the debugger to work again is to shutdown and restart VS.
This also happens if I have the Visual Studio hosting process turned off. The application only has one exit point in the Main method and when this happens a breakpoint on that line of code is not hit.
I cannot figure out how to get any more detail about why this is happening to troubleshoot further. I have put code in the AppDomain.CurrentDomain.UnhandledExcpetion handler as well as the Application.ApplicationExit handler, but they are not being hit when this problem occurs. I also don't see anything in the Windows event log, etc.
Output Window sample
...
'MyApp.vshost.exe' (CLR v4.0.30319: MyApp.vshost.exe): Loaded
'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.IdentityModel\v4.0_4.0.0.0__b77a5c561934e089\System.IdentityModel.dll'.
Cannot find or open the PDB file.
'MyApp.vshost.exe' (CLR v4.0.30319: MyApp.vshost.exe): Loaded
'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel.Web\v4.0_4.0.0.0__31bf3856ad364e35\System.ServiceModel.Web.dll'.
Cannot find or open the PDB file.
'MyApp.vshost.exe' (CLR v4.0.30319: MyApp.vshost.exe): Loaded
'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.VisualStudio.Diagnostics.ServiceModelSink\v4.0_4.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Diagnostics.ServiceModelSink.dll'.
Cannot find or open the PDB file.
'MyApp.vshost.exe' (CLR v4.0.30319: MyApp.vshost.exe): Loaded
'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Net.Http\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Net.Http.dll'.
Skipped loading symbols. Module is optimized and the debugger option
'Just My Code' is enabled.
The thread 0xf18 has exited with code 259 (0x103).
The thread 0x2928 has exited with code 259 (0x103).
The thread 0x3654 has exited with code 259 (0x103).
The program '[13476] MyApp.vshost.exe' has exited with code -1
(0xffffffff).
I found the events below in the event log. However, it was in a weird spot I’ve never looked before Event Viewer -> Custom Views -> Administrative Events. This lead me to the MS KB http://support.microsoft.com/kb/2773443.
The MyApp project is targeting .NET 4.0 and I recently have installed Visual Studio 2013 on my laptop (.NET 4.5), which is around the time the issue started to occur. So I assume this is my issue.
What I don’t understand is why this exception wasn’t raising the AppDomain.UnhandledExcpetion event in my MyApp project and instead was silently terminating the process. The WCF service that was causing this issue was being started from a new thread that was being kicked off, but I think exceptions in this thread should still raise the AppDomain.UnhandledExcpetion event. I verified the UndhandledException handler is working in my application.
To resolve this, I have moved the startup of this service to its own project that targets .NET 3.5 and x86. This more mimics how we run the application in production anyway so it works for me. There is a patch and various work arounds in the Microsoft KB as well.
I hope this helps someone, I was beating my head against the wall trying to figure out how to even get the exception that was causing my issue.
Log Name: Application
Source: .NET Runtime
Date: 1/21/2014 9:09:23 AM
Event ID: 1026
Task Category: None
Level: Error
Keywords: Classic
User: N/A
Computer: DUDELT
Description:
Application: MyApp.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.ServiceModel.AddressAlreadyInUseException
Stack:
at System.ServiceModel.Channels.TransportManager.Open(System.ServiceModel.Channels.TransportChannelListener)
at System.ServiceModel.Channels.TransportManagerContainer.Open(System.ServiceModel.Channels.SelectTransportManagersCallback)
at System.ServiceModel.Channels.TransportChannelListener.OnOpen(System.TimeSpan)
at System.ServiceModel.Channels.ConnectionOrientedTransportChannelListener.OnOpen(System.TimeSpan)
at System.ServiceModel.Channels.TcpChannelListener`2[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].OnOpen(System.TimeSpan)
at System.ServiceModel.Channels.CommunicationObject.Open(System.TimeSpan)
at System.ServiceModel.Channels.ReliableChannelListenerBase`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].OnOpen(System.TimeSpan)
at System.ServiceModel.Channels.CommunicationObject.Open(System.TimeSpan)
at System.ServiceModel.Dispatcher.ChannelDispatcher.OnOpen(System.TimeSpan)
at System.ServiceModel.Channels.CommunicationObject.Open(System.TimeSpan)
at System.ServiceModel.ServiceHostBase.OnOpen(System.TimeSpan)
at System.ServiceModel.Channels.CommunicationObject.Open(System.TimeSpan)
at System.ServiceModel.Channels.CommunicationObject.Open()
at MyApp32.MyApp32.Main()
at System.Threading.ThreadHelper.ThreadStart_Context(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Threading.ThreadHelper.ThreadStart()
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name=".NET Runtime" />
<EventID Qualifiers="0">1026</EventID>
<Level>2</Level>
<Task>0</Task>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2014-01-21T14:09:23.000000000Z" />
<EventRecordID>287767</EventRecordID>
<Channel>Application</Channel>
<Computer>DUDELT</Computer>
<Security />
</System>
<EventData>
<Data>Application: MyApp.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.ServiceModel.AddressAlreadyInUseException
Stack:
at System.ServiceModel.Channels.TransportManager.Open(System.ServiceModel.Channels.TransportChannelListener)
at System.ServiceModel.Channels.TransportManagerContainer.Open(System.ServiceModel.Channels.SelectTransportManagersCallback)
at System.ServiceModel.Channels.TransportChannelListener.OnOpen(System.TimeSpan)
at System.ServiceModel.Channels.ConnectionOrientedTransportChannelListener.OnOpen(System.TimeSpan)
at System.ServiceModel.Channels.TcpChannelListener`2[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].OnOpen(System.TimeSpan)
at System.ServiceModel.Channels.CommunicationObject.Open(System.TimeSpan)
at System.ServiceModel.Channels.ReliableChannelListenerBase`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].OnOpen(System.TimeSpan)
at System.ServiceModel.Channels.CommunicationObject.Open(System.TimeSpan)
at System.ServiceModel.Dispatcher.ChannelDispatcher.OnOpen(System.TimeSpan)
at System.ServiceModel.Channels.CommunicationObject.Open(System.TimeSpan)
at System.ServiceModel.ServiceHostBase.OnOpen(System.TimeSpan)
at System.ServiceModel.Channels.CommunicationObject.Open(System.TimeSpan)
at System.ServiceModel.Channels.CommunicationObject.Open()
at MyApp32. MyApp 32.Main()
at System.Threading.ThreadHelper.ThreadStart_Context(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Threading.ThreadHelper.ThreadStart()
</Data>
</EventData>
</Event>
Log Name: Application
Source: Application Error
Date: 1/21/2014 9:09:23 AM
Event ID: 1000
Task Category: (100)
Level: Error
Keywords: Classic
User: N/A
Computer: DUDELT
Description:
Faulting application name: MyApp.exe, version: 0.0.0.0, time stamp: 0x52dd9b89
Faulting module name: KERNELBASE.dll, version: 6.1.7601.18229, time stamp: 0x51fb1116
Exception code: 0xe0434352
Fault offset: 0x0000c41f
Faulting process id: 0x3ac0
Faulting application start time: 0x01cf16b23d49d636
Faulting application path: C:\MyApp\MyApp\bin\Debug\MyApp.exe
Faulting module path: C:\Windows\syswow64\KERNELBASE.dll
Report Id: a0b3e605-82a5-11e3-ab71-0021cc6f2033
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="Application Error" />
<EventID Qualifiers="0">1000</EventID>
<Level>2</Level>
<Task>100</Task>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2014-01-21T14:09:23.000000000Z" />
<EventRecordID>287768</EventRecordID>
<Channel>Application</Channel>
<Computer>DUDELT</Computer>
<Security />
</System>
<EventData>
<Data>MyApp.exe</Data>
<Data>0.0.0.0</Data>
<Data>52dd9b89</Data>
<Data>KERNELBASE.dll</Data>
<Data>6.1.7601.18229</Data>
<Data>51fb1116</Data>
<Data>e0434352</Data>
<Data>0000c41f</Data>
<Data>3ac0</Data>
<Data>01cf16b23d49d636</Data>
<Data>C:\code\MyApp\MyApp\bin\Debug\MyApp.exe</Data>
<Data>C:\Windows\syswow64\KERNELBASE.dll</Data>
<Data>a0b3e605-82a5-11e3-ab71-0021cc6f2033</Data>
</EventData>
</Event>
I hit the same issue, and it looks a .net undocumented issue. But you can mitigate it as follow:
find the portion of code that fail, and follow the class that you try to read.
add a default constructor for that class. The serialization in some case needs a default constructor to create the objects, and this is the actual issue.
Hope this works for future generations who will search for this error! :)
D

How to debug Castle Windsor installation/registration exception

My team tried some time ago to start using to Castle Windsor (3.2.0) for IoC goodness. Our trial runs on development boxes went peachy, but when we tried to run the code on the production server, it failed with the following exception
Application: XXXX
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.IO.FileNotFoundException
Stack:
at System.Signature.GetSignature(Void*, Int32, System.RuntimeFieldHandleInternal, System.IRuntimeMethodInfo, System.RuntimeType)
at System.Reflection.RuntimeMethodInfo.get_Signature()
at System.Reflection.RuntimeMethodInfo.GetParametersNoCopy()
at System.Reflection.RuntimePropertyInfo.GetIndexParametersNoCopy()
at System.Reflection.RuntimePropertyInfo.GetIndexParameters()
at Castle.MicroKernel.ModelBuilder.Inspectors.PropertiesDependenciesModelInspector.IsValidPropertyDependency(System.Reflection.PropertyInfo)
at System.Linq.Enumerable+WhereArrayIterator`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].MoveNext()
at System.Collections.Generic.List`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]..ctor(System.Collections.Generic.IEnumerable`1<System.__Canon>)
at System.Linq.Enumerable.ToList[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
at Castle.MicroKernel.ModelBuilder.Inspectors.PropertiesDependenciesModelInspector.InspectProperties(Castle.Core.ComponentModel)
at System.Collections.Generic.List`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].ForEach(System.Action`1<System.__Canon>)
at Castle.MicroKernel.ModelBuilder.DefaultComponentModelBuilder.BuildModel(Castle.MicroKernel.ModelBuilder.IComponentModelDescriptor[])
at Castle.MicroKernel.Registration.ComponentRegistration`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Castle.MicroKernel.Registration.IRegistration.Register(Castle.MicroKernel.IKernelInternal)
at Castle.MicroKernel.DefaultKernel.Register(Castle.MicroKernel.Registration.IRegistration[])
at Castle.Windsor.WindsorContainer.Register(Castle.MicroKernel.Registration.IRegistration[])
at Sproom.Web.Infrastructure.WindsorInstaller.Install(Castle.Windsor.IWindsorContainer, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore)
at Castle.Windsor.Installer.AssemblyInstaller.Install(Castle.Windsor.IWindsorContainer, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore)
at Castle.Windsor.Installer.CompositeInstaller.Install(Castle.Windsor.IWindsorContainer, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore)
at Castle.Windsor.WindsorContainer.Install(Castle.MicroKernel.Registration.IWindsorInstaller[], Castle.Windsor.Installer.DefaultComponentInstaller)
at Castle.Windsor.WindsorContainer.Install(Castle.MicroKernel.Registration.IWindsorInstaller[])
This was a showstopper for us and proved quite difficult to google. I recently had some time to throw at the issue, and successfully debugged it down to the fact that a component had an explicit reference/dependency (C#, not windsor) on a MVC 3 dll. The server was a newly commissioned one, and had only MVC 4 installed. All dev boxes had MVC 3 installed, making the problem only reproducible on production.
I debugged this by binary commenting out component registration code, converting mass registrations to per-component registration, and then staring at the offending component until I clicked the right place and had an epiphany.
My question is now, was there a better way that I could have debugged this? Could I have had Windsor give better information? And why was this a problem for Windsor when it was not in the normal non-Windsor case? I and the team are a bit leery of using Windsor now, given the nastyness of non-googlable errors only reproducible on production, so I hope I missed some nice ways of addressing this problem.
May be this answer help you to get better information while debugging stuff: https://stackoverflow.com/a/9539679/1158735

App closing as soon as it loads, with no errors

One of my applications runs fine on my developing machine, although if I run it on another computer the app closes as soon as it loads.
I remember I got this problem one time when I didn't deploy the app.config, but I made sure it was deployed this time.
Since the application gives absolutely no errors and all the results from Google are misguided, I have no idea what to do.
What could be causing this behavior? Even though app.config is deployed I think it may be something about it or something about one or more references, but I'm not sure.
EDIT:
Apparently there was a call stack on the event logs
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.ArgumentException
Stack:
at System.Data.Common.DbProviderFactories.GetFactory(System.String)
at System.Data.Entity.Infrastructure.SqlCeConnectionFactory.CreateConnection(System.String)
at System.Data.Entity.Internal.LazyInternalConnection.Initialize()
at System.Data.Entity.Internal.LazyInternalConnection.get_ProviderName()
at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(System.Type)
at System.Data.Entity.Internal.Linq.InternalSet`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Initialize()
at System.Data.Entity.Internal.Linq.InternalSet`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].GetEnumerator()
at System.Data.Entity.Infrastructure.DbQuery`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].System.Collections.Generic.IEnumerable<TResult>.GetEnumerator()
at System.Collections.Generic.List`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]..ctor(System.Collections.Generic.IEnumerable`1<System.__Canon>)
at System.Linq.Enumerable.ToList[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
at MyApp.Database.Repositories.GuidRepository.GetNewest()
at MyApp.Components.Common.User.SystemGuid.SetupGuid()
at MyApp.Form1.InitializeSoftWare()
at MyApp.Form1..ctor()
at MyApp.Program.Main()

App exe crashing at startup. Faulting module path c:\windows\syswow64\kernalbase.dll

Whenever I try to launch my app on a machine that isnt mine it crashes at start up. I am at a loss and have done a ton of searching with no resolution. There is no real error I just get the standard windows 7 not responding. All machines are win7Pro 64 with .net4. I am seeing the event viewer logs below.
Event id 1000:
Faulting application name: MarketingRequests.exe, version: 1.0.0.0, time stamp: 0x5033e787
Faulting module name: KERNELBASE.dll, version: 6.1.7601.17651, time stamp: 0x4a5bdbdf
Exception code: 0xe0434352
Fault offset: 0x0000b9bc
Faulting process id: 0x1ecc
Faulting application start time: 0x01cd7fe56831cfd9
Faulting application path: C\Intranet\MarketingRequests.exe
Faulting module path: C:\Windows\syswow64\KERNELBASE.dll
Report Id: a78399b1-ebd8-11e1-9474-f04da20e6eaf
I am also seeing event ID 1026, .net runtime:
Log Name: Application
Source: .NET Runtime
Date: 8/21/2012 9:08:53 PM
Event ID: 1026
Task Category: None
Level: Error
Keywords: Classic
User: N/A
Computer: CORRIE-Z.msing.local
Description:
Application: ExpenseReport.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.InvalidOperationException
Stack:
at System.Data.Linq.SqlClient.SqlProvider.Execute(System.Linq.Expressions.Expression, QueryInfo, System.Data.Linq.SqlClient.IObjectReaderFactory, System.Object[], System.Object[], System.Data.Linq.SqlClient.ICompiledSubQuery[], System.Object)
at System.Data.Linq.SqlClient.SqlProvider.ExecuteAll(System.Linq.Expressions.Expression, QueryInfo[], System.Data.Linq.SqlClient.IObjectReaderFactory, System.Object[], System.Data.Linq.SqlClient.ICompiledSubQuery[])
at System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(System.Linq.Expressions.Expression)
at System.Data.Linq.DataQuery1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].System.Linq.IQueryProvider.Execute[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.Linq.Expressions.Expression)
at System.Linq.Queryable.First[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.Linq.IQueryable1)
at ExpenseReport.frmMain.refreshEmpInfo()
at ExpenseReport.frmMain..ctor()
at ExpenseReport.Program.Main()
Event Xml:
1026
2
0
0x80000000000000
26474
Application
CORRIE-Z.msing.local
Application: ExpenseReport.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.InvalidOperationException
Stack:
at System.Data.Linq.SqlClient.SqlProvider.Execute(System.Linq.Expressions.Expression, QueryInfo, System.Data.Linq.SqlClient.IObjectReaderFactory, System.Object[], System.Object[], System.Data.Linq.SqlClient.ICompiledSubQuery[], System.Object)
at System.Data.Linq.SqlClient.SqlProvider.ExecuteAll(System.Linq.Expressions.Expression, QueryInfo[], System.Data.Linq.SqlClient.IObjectReaderFactory, System.Object[], System.Data.Linq.SqlClient.ICompiledSubQuery[])
at System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(System.Linq.Expressions.Expression)
at System.Data.Linq.DataQuery1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].System.Linq.IQueryProvider.Execute[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.Linq.Expressions.Expression)
at System.Linq.Queryable.First[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.Linq.IQueryable1<System.__Canon>)
at ExpenseReport.frmMain.refreshEmpInfo()
at ExpenseReport.frmMain..ctor()
at ExpenseReport.Program.Main()
It looks like frmMain.refreshEmpInfo contains a LINQ query that retrieves a record from the database, and the LINQ query calls First() to get the first record. Is it possible that no records are being returned, which would cause First() to throw an InvalidOperationException?
(It might be helpful if you posted the code in frmMain.refreshEmpInfo. You might also want to wrap that code in a try...catch block and display the exception details in a message box.)

Categories