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()
Related
I am working on .NET framework 4.6 Web API application. My app is working on my machine and I was able to build it in my local but when I push it to our Azure Dev OPS CI, I got this build error.
Error CS0433: The type 'ZipArchive' exists in both 'System.IO.Compression, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' and 'System.IO.Compression, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
: Error CS0433: The type 'ZipArchiveMode' exists in both 'System.IO.Compression, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' and 'System.IO.Compression, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
Process 'msbuild.exe' exited with code '1'.
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();
}
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.
I've done nothing more than compile the sample SSRS delivery extension and deploy it to the server as per instructions. When I make a call to the ReportService2010 ListExtensions web service method, the extension shows up in the list of results. However, when I go to create a subscription in the Report Manager, as soon as I choose the Printer Delivery Sample from the drop-down list of available delivery extensions, I get this error:
Invalid Class Name
I'm running SSRS 2012 SP2 (11.0.5569.0) on Windows Server 2012 R2.
EDIT: I found this in the logs:
It turns out that the ReportManager (the ASP.NET UI) does log to the C:\Program Files\Microsoft SQL Server\MSRSxx.MSSQLSERVER\Reporting Services\LogFiles directory. I initially saw only subscription- (i.e. service-)related events in those files and assumed that if the ReportManager did log, those files must be elsewhere.
extensionfactory!ReportManager_0-3!53c!06/02/2015-16:27:40:: e ERROR: Exception caught instantiating Printer Delivery Sample report server extension:
System.Security.SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
at System.Reflection.Assembly._GetType(String name, Boolean throwOnError, Boolean ignoreCase)
at System.Reflection.Assembly.GetType(String name, Boolean throwOnError)
at Microsoft.ReportingServices.Diagnostics.ExtensionClassFactory.<>c__DisplayClass9.<GetExtensionLocalizedName>b__6()
at Microsoft.ReportingServices.Diagnostics.RevertImpersonationContext.<>c__DisplayClass1.<Run>b__0(Object state)
at System.Security.SecurityContext.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Security.SecurityContext.Run(SecurityContext securityContext, ContextCallback callback, Object state)
at Microsoft.ReportingServices.Diagnostics.RevertImpersonationContext.Run(ContextBody callback)
at Microsoft.ReportingServices.Diagnostics.ExtensionClassFactory.GetExtensionLocalizedName(Extension extConfig, Boolean removeFailuresAndContinue)
The action that failed was:
InheritanceDemand
The type of the first permission that failed was:
System.Web.AspNetHostingPermission
The first permission that failed was:
<IPermission class="System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Level="Minimal"/>
The demand was for:
<PermissionSet class="System.Security.PermissionSet" version="1">
<IPermission class="System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Level="Minimal"/>
</PermissionSet>
The granted set of the failing assembly was:
<PermissionSet class="System.Security.PermissionSet" version="1">
<IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Execution"/>
<IPermission class="System.Security.Permissions.StrongNameIdentityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" PublicKeyBlob="00240000048000009400000006020000002400005253413100040000010001009D92F3DD932D20261ADD96F81554DD22E89D6C820CE81177D791891A9415FE8499B0A22270329D737DD29FCF15784BCE44B876E2099FA06B113712581C764E7B033E3F487EA8774CB78CB79FA5951A501F4FA61496F0E07AB2A48020A99435C0F2DE60282540E72CCCB63F05ECEFB90BD542E30EE34AA8005C51F2EC0BF606C0" Name="Microsoft.Samples.ReportingServices.PrinterDeliverySample" AssemblyVersion="1.0.5627.17054"/>
<IPermission class="System.Security.Permissions.UrlIdentityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Url="file:///C:/Program Files/Microsoft SQL Server/MSRS11.MSSQLSERVER/Reporting Services/ReportManager/bin/Microsoft.Samples.ReportingServices.PrinterDeliverySample.DLL"/>
<IPermission class="System.Security.Permissions.ZoneIdentityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Zone="MyComputer"/>
</PermissionSet>
The assembly or AppDomain that failed was:
Microsoft.Samples.ReportingServices.PrinterDeliverySample, Version=1.0.5627.17054, Culture=neutral, PublicKeyToken=f0209f2bcebc8576
The Zone of the assembly that failed was:
MyComputer
The Url of the assembly that failed was:
file:///C:/Program Files/Microsoft SQL Server/MSRS11.MSSQLSERVER/Reporting Services/ReportManager/bin/Microsoft.Samples.ReportingServices.PrinterDeliverySample.DLL
Yes, I feel a bit foolish. Okay - now what do I do with this information? Time to brush up on Code Access Security again...
Have a look at this:
http://blogs.msdn.com/b/friis/archive/2010/06/09/system-security-securityexception-request-for-the-permission-of-type-system-web-aspnethostingpermission-failed.aspx
Try switching the Application Pool Identity to Network Service. Also, check your DLL to see if it needs to be unblocked, which is also mentioned in that article.
Can you please confirm your failed assembly available/registered at C:\windows\assembly of reportserver machine. if its not registered then try to install that in GAC "Install an Assembly into the Global Assembly Cache"
Global Assembly Cache
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