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
Related
I've a strange problem at the moment where i sometimes get the following exception:
Type System.Object found in more than one assembly (mscorlib, Version=4.0.0.0, ... and System.Runtime, Version=4.0.0.0, ...)
The app is a classic desktop app which references .NET 4.5 but the main problem is that this only happens sometimes so it's really hard to reproduce.
I think that it allways works if System.Runtime gets not loaded.
But how can figure out who is responsible for loading System.Runtime? Why is this assembly beeing loaded sometimes?
UPDATE:
I think the problem is this assembly: Microsoft.CodeDom.Providers.DotNetCompilerPlatform This assembly internally loads System.Runtime via: Assembly.Load("System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a").Location;
But i've no idea how to solve this problem.
Does anyone have an idea?
I'm trying to make a C# Console Application using .NetCore on "Visual Studio 2017" for the sake of running it on CentOS 7, what seems to be the issue is that apparently the .NetCore doesn't have some of the Classes that's inside the .Net Framework, or that's what I think the problem is.
So I've tried adding a reference to assembly mscorlib but that just made the errors even more..
Error CS0433 The type 'StringBuilder' exists in both 'mscorlib,
Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' and
'System.Runtime, Version=4.1.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a'
Any idea how can I solve this issue?
Thanks.
.NetCore Console Application using Visual Studio 2017
MarshalByRefObject is not part of .NetCore so you should not use it.
Scroll to comments and you will find info and link about replacement.
https://blogs.msdn.microsoft.com/dotnet/2016/05/27/making-it-easier-to-port-to-net-core/
I'm attempting to run a web application from VWD 2010 using Web Forms (Not MVC) but am getting this error message below:
Assembly 'WebHelper, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' uses 'Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' which has a higher version than referenced assembly 'Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
In my web.config file, there is this line of code below which I have tried as commented out, and left alone, but neither way makes any difference.
<add assembly="Microsoft.ReportViewer.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
Any suggestions welcome.
Thank you!
I solved this in the end, but how graceful it is yet to be seen. I tried to download the 10.0.0.0 version of the Microsoft.ReportViewer.WebForms dll from Microsoft but I couldn't quite work out where it was saved to, and when I did, It was a word document which didn't really do much for me.
As it happens, my colleague had it on her machine, so I simply copied hers and it put in place on my machine. Added the new reference to my project. Problem solved.
I'm currently dealing with a problem on a ASP.NET MVC4 Application, I did a change of .NET Framework (from 4.5 to 4 then to 4.5 again) and it updated my NuGet packages so my Web.config is all messed up and i can't get rid of those errors that the YSOD shows me. Can you explain me a bit what can i do to correct those errors ?
Here's the error i get.
[A]System.Web.WebPages.Razor.Configuration.HostSection cannot be cast
to [B]System.Web.WebPages.Razor.Configuration.HostSection. Type A
originates from 'System.Web.WebPages.Razor, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35' in the context
'Default' at location
'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.WebPages.Razor\v4.0_2.0.0.0__31bf3856ad364e35\System.Web.WebPages.Razor.dll'.
Type B originates from 'System.Web.WebPages.Razor, Version=3.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35' in the context
'Default' at location
'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET
Files\root\5ccfcdb0\4d5a6f51\assembly\dl3\5f700272\1350df4e_ebe9ce01\System.Web.WebPages.Razor.dll'.
Okay i solved my problem by myself.
I updated manually in the Web.config (from the Views Folder) the configuration to Version=3.0.0.0 and the version of the MvcWebRazorHostFactory (same file) to Version=5.0.0.0
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()