Windsor WCF integration broken after ASP.NET 4.6 upgrade

488 views
Skip to first unread message

Filip Kinsky

unread,
Mar 23, 2015, 10:23:46 AM3/23/15
to castle-pro...@googlegroups.com
Hello,
I was trying Visual Studio 2015 CTP and got ASP.NET 4.6 upgrade during the VS installation. I use Windsor WCF integration, which seems to get broken due to this upgrade. I'm injecting Castle.Facilities.WcfIntegration.IWcfClientFactory to my services and use this simple extension method to retrieve the WCF client:

        public static T GetClient<T>(this IWcfClientFactory factory) where T : class
       
{
           
var componentName = typeof (T).FullName;
           
return factory.GetClient<T>(componentName);
       
}


The GetClient method throws this exception after the upgrade:

Castle.MicroKernel.ComponentActivator.ComponentActivatorException: WcfClientActivator: could not proxy component XXX ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at
System.RuntimeMethodHandle.GetHashCode()
   at
System.Collections.Generic.ObjectEqualityComparer`1.GetHashCode(T obj)
   at System.Collections.Generic.Dictionary`
2.FindEntry(TKey key)
   at
System.ServiceModel.Dispatcher.OperationSelectorBehavior.MethodInfoOperationSelector..ctor(ContractDescription description, MessageDirection directionThatRequiresClientOpSelection)
   at
System.ServiceModel.Dispatcher.OperationSelectorBehavior.System.ServiceModel.Description.IContractBehavior.ApplyClientBehavior(ContractDescription description, ServiceEndpoint endpoint, ClientRuntime proxy)
   at
System.ServiceModel.Description.DispatcherBuilder.ApplyClientBehavior(ServiceEndpoint serviceEndpoint, ClientRuntime clientRuntime)
   at
System.ServiceModel.Description.DispatcherBuilder.BuildProxyBehavior(ServiceEndpoint serviceEndpoint, BindingParameterCollection& parameters)
   at
System.ServiceModel.Channels.ServiceChannelFactory.BuildChannelFactory(ServiceEndpoint serviceEndpoint, Boolean useActiveAutoClose)
   at
System.ServiceModel.ChannelFactory.CreateFactory()
   at
System.ServiceModel.ChannelFactory.OnOpening()
   at
System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at
System.ServiceModel.ChannelFactory.EnsureOpened()
   at
System.ServiceModel.ChannelFactory`1.CreateChannel(EndpointAddress address, Uri via)
   at System.ServiceModel.ChannelFactory`
1.CreateChannel()
   at
Castle.Facilities.WcfIntegration.WcfClientActivator.<>c__DisplayClass6.<GetChannelCreator>b__1()
   at
Castle.Facilities.WcfIntegration.WcfChannelHolder.CreateChannel()
   at
Castle.Facilities.WcfIntegration.WcfChannelHolder..ctor(ChannelCreator channelCreator, IWcfBurden burden, Nullable`1 closeTimeout)
   at Castle.Facilities.WcfIntegration.WcfClientActivator.Instantiate(CreationContext context)
   --- End of inner exception stack trace ---
   at Castle.Facilities.WcfIntegration.WcfClientActivator.Instantiate(CreationContext context)
   at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext context)
   at Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext context, Burden burden)
   at Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.CreateInstance(CreationContext context, Boolean trackedExternally)
   at Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.Resolve(CreationContext context, IReleasePolicy releasePolicy)
   at Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, Boolean requiresDecommission, Boolean instanceRequired, Burden& burden)
   at Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context, Boolean instanceRequired)
   at Castle.MicroKernel.Handlers.AbstractHandler.Resolve(CreationContext context)
   at Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler handler, Type service, IDictionary additionalArguments, IReleasePolicy policy)
   at Castle.MicroKernel.DefaultKernel.Castle.MicroKernel.IKernelInternal.Resolve(String key, Type service, IDictionary arguments, IReleasePolicy policy)
   at Castle.Facilities.WcfIntegration.WcfClientFactorySelector.<>c__DisplayClass2.<SelectComponent>b__1(IKernelInternal k, IReleasePolicy p)
   at Castle.Facilities.TypedFactory.Internal.TypedFactoryInterceptor.Resolve(IInvocation invocation)
   at Castle.Facilities.TypedFactory.Internal.TypedFactoryInterceptor.Intercept(IInvocation invocation)
   at Castle.DynamicProxy.AbstractInvocation.Proceed()
   at Castle.Proxies.IWcfClientFactoryProxy.GetClient[T](String name)

There's obviously some breaking change in ASP.NET 4.6 WCF. I already tried to debug the Windsor source code, bud wasn't able to understand the code enough to be able to figure out where the problem is. Did anyone faced the same problem? Any hints what to try to workaround the problem?

Diana Ionita

unread,
Mar 30, 2015, 9:45:20 AM3/30/15
to castle-pro...@googlegroups.com
I'm running into exactly the same issue. Would really appreciate a workaround.

Thanks!

Filip Kinský

unread,
Mar 30, 2015, 11:01:23 AM3/30/15
to castle-pro...@googlegroups.com
The same error ocurs after recent Windows 10 Windows Update when ASP.NET 4.6 runtime upgrade was delivered btw.

--
You received this message because you are subscribed to a topic in the Google Groups "Castle Project Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/castle-project-users/QIPplgOhPJ0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to castle-project-u...@googlegroups.com.
To post to this group, send email to castle-pro...@googlegroups.com.
Visit this group at http://groups.google.com/group/castle-project-users.
For more options, visit https://groups.google.com/d/optout.

Filip Kinsky

unread,
Apr 14, 2015, 3:27:13 PM4/14/15
to castle-pro...@googlegroups.com
I just created an issue for this problem: http://github.com/castleproject/Windsor/issues/84
To unsubscribe from this group and all its topics, send an email to castle-project-users+unsub...@googlegroups.com.
To post to this group, send email to castle-project-users@googlegroups.com.

Milan Cerny

unread,
May 4, 2015, 10:55:38 AM5/4/15
to castle-pro...@googlegroups.com
Hi Filip. Me too (the same issue). It's another reason to run out of WCF to the simple html requests :)

Dne úterý 14. dubna 2015 21:27:13 UTC+2 Filip Kinsky napsal(a):
To post to this group, send email to castle-pro...@googlegroups.com.

Matteo Migliore

unread,
May 4, 2015, 11:06:28 AM5/4/15
to castle-pro...@googlegroups.com
I'm trying to use WCF Unity to solve the problem and remove Castle, not happy of this, but we cannot wait more.

We are already migrating to web API.

Henry Conceição

unread,
May 4, 2015, 4:54:52 PM5/4/15
to castle-pro...@googlegroups.com
So, you do have time/disposition to complain, time/disposition to migrate your codebase, time/disposition to re-test it, but don't have "time" to work on a pull request. Interesting...

Matteo Migliore

unread,
May 4, 2015, 4:58:45 PM5/4/15
to castle-pro...@googlegroups.com
If you have time to solve it, do it. This is a forum to solve problems or create problems?

hammett

unread,
May 4, 2015, 5:55:50 PM5/4/15
to castle-pro...@googlegroups.com
I think the point is that we work on stuff that happen to be the
intersection of what other people needs *and* what we need.

I havent used WCF.. ever. Craig originally created the WCF facility
out of need, but I dont think he's doing .NET anymore. So either the
people who need the facility are able to maintain it, or it's a dead
component of this project.

Unfortunately, this is how OSS works when there isn't a company
backing it up, allocating their people's time to fix bugs.
>>>>>>> castle-project-u...@googlegroups.com.
>>>>>>> To post to this group, send email to castle-pro...@googlegroups.com.
>>>>>>> Visit this group at
>>>>>>> http://groups.google.com/group/castle-project-users.
>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>>>
> --
> You received this message because you are subscribed to the Google Groups
> "Castle Project Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to castle-project-u...@googlegroups.com.
> To post to this group, send email to castle-pro...@googlegroups.com.
> Visit this group at http://groups.google.com/group/castle-project-users.
> For more options, visit https://groups.google.com/d/optout.



--
Cheers,
hammett
http://www.d-collab.com/
http://www.hammettblog.com/

Matteo Migliore

unread,
May 5, 2015, 3:55:37 AM5/5/15
to castle-pro...@googlegroups.com
I think that even if the main developers have no time to follow the project, they could answer in a better way.

We already have OSS code to maintain and we never answer "do it yourself" if somebody discovers a bug o need a feature.

That said, I don't understand how a new version of the .NET framework can cause an interaction with a previous version that should be isolated and allow side by side versioning.

Is not a criticism versus Castle but a question related to .NET that for me is unespected.

Thanks.
>>>>>>> To post to this group, send email to castle-pro...@googlegroups.com.
>>>>>>> Visit this group at
>>>>>>> http://groups.google.com/group/castle-project-users.
>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>>>
> --
> You received this message because you are subscribed to the Google Groups
> "Castle Project Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an

Jonathon Rossi

unread,
May 5, 2015, 4:29:31 AM5/5/15
to Castle Project Users
Matteo your comments here and on the GitHub issue have come across as a bit hostile (whether intended or not), especially deleting some of your GitHub comments, and that is why you haven't received the friendliest response. Lets end the discussion here on how people believe we should respond to users and focus on the task at hand, we have been honest that we weren't looking into the issue so users knew, definitely no malice.

A week after the defect was logged on GitHub I went to the trouble of setting up a VS2015 Preview VM to see if I could track the problem down, and requested that someone more familiar put together a repro without Castle libraries to report to Microsoft. I still believe this is a WCF defect and not a Castle WCF facility one.

I understand that it is frustrating, but .NET 4.6 is definitely not a side-by-side runtime, here is Microsoft's description of it. With new features like a brand new 64-bit JIT I'm not surprised there are a few regressions, using prerelease software is going to have the early adopter problem unfortunately. There might still be time to get a fix into .NET 4.6 if the defect is actually a common WCF use case, or into the first update.

> The Microsoft .NET Framework 4.6 Preview is a highly compatible, in-place update to the Microsoft .NET Framework 4, .NET Framework 4.5, .NET Framework 4.5.1 and .NET Framework 4.5.2.

Jono

>>>>>>> To post to this group, send email to castle-pro...@googlegroups.com.
>>>>>>> Visit this group at
>>>>>>> http://groups.google.com/group/castle-project-users.
>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>>>
> --
> You received this message because you are subscribed to the Google Groups
> "Castle Project Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> To post to this group, send email to castle-pro...@googlegroups.com.
> Visit this group at http://groups.google.com/group/castle-project-users.
> For more options, visit https://groups.google.com/d/optout.



--

--
You received this message because you are subscribed to the Google Groups "Castle Project Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to castle-project-u...@googlegroups.com.

To post to this group, send email to castle-pro...@googlegroups.com.
Visit this group at http://groups.google.com/group/castle-project-users.
For more options, visit https://groups.google.com/d/optout.



--
Jono

Matteo Migliore

unread,
May 5, 2015, 4:53:03 AM5/5/15
to castle-pro...@googlegroups.com
My comments are hostile?

On GitHub I wrote "I've the same problem. Please, fix it ASAP.". What is hostile of this request?

ASAP? With "Please" in front. Ok, I'm sorry, for me just means "I've the same problem. Please, fix it as soon as possible.". As possible and if possible, not now :).

The other "hostile" comment is "
I'm trying to use WCF Unity to solve the problem and remove Castle, not happy of this, but we cannot wait more."

Hostile? Can I discuss about an alternative solution? I don't know if and how any people are working on Castle, I didn't wont to pull hands on the codebase, so I tried a similar framework. From my point of view, because I don't know the internal organization of Castle, it should be abandoned and I can search for another IoC package that should be supported directly from Microsoft.

As Hammet said "
Unfortunately, this is how OSS works when there isn't a company backing it up, allocating their people's time to fix bugs.", so if a company, like Microsoft, implements a similar pack, I should propose to switch to it if it make sense.

Anyway, thank you for thanks for reminding me that .NET Framework 4.6 is not side-by-side but an update, is a really important underline! :)

At the end, I downloaded the source code to undestand if I can patch Castle WCF Facility, I can wait your fix or I've to go forward to try to make a pull request?

Thank you again Jono!
>>>>>>> To post to this group, send email to castle-pro...@googlegroups.com.
>>>>>>> Visit this group at
>>>>>>> http://groups.google.com/group/castle-project-users.
>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>>>
> --
> You received this message because you are subscribed to the Google Groups
> "Castle Project Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> To post to this group, send email to castle-pro...@googlegroups.com.
> Visit this group at http://groups.google.com/group/castle-project-users.
> For more options, visit https://groups.google.com/d/optout.



--

--
You received this message because you are subscribed to the Google Groups "Castle Project Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to castle-project-users+unsub...@googlegroups.com.

To post to this group, send email to castle-pro...@googlegroups.com.
Visit this group at http://groups.google.com/group/castle-project-users.
For more options, visit https://groups.google.com/d/optout.



--
Jono

hammett

unread,
May 5, 2015, 4:55:52 AM5/5/15
to castle-pro...@googlegroups.com
Different layers of the framework receive different levels of scrutiny
towards backward compatibility. The core fx, that includes the bcl is
definitely back compat if they say it's a in-place install -- not sure
that's the claim for 4.6, havent checked.

Now, EF (sql team), WCF, WF (connected systems) and even things like
unicode support and System.Net (windows) live in different divisions
within MS. While they are told about the requirements, there arent
enough resources within the fx team to ensure there are nothing
breaking compat, esp for more advanced and rarely touched apis, which
seems to be the case for wcf.

Jonathon Rossi

unread,
May 5, 2015, 6:37:47 AM5/5/15
to Castle Project Users
Krzysztof and I read it as a demand, maybe it's a language/culture difference, but ASAP to me means "drop everything you are doing right now and do this" (unless already fighting a fire). Deleting your comments and starting on this thread about removing Castle from your project aren't the most positive ways to start a conversation. No permanent harm done, but something to think about in the future when words are all you have to convey your message.

The reason there is limited "support" or love for open source WCF integration projects is because it is WCF clear and simple, most open source developers have moved on as have many at Microsoft. You'll also see that the Unity WCF project is no longer maintained as per their web site:
> IMPORTANT: This project is no longer supported and is in need of a new owner. See the annoucement

Looks like Unity itself hasn't had a release in a year, defects and PRs are going unanswered, and the top of the page indicates that there isn't any active work happening:
> Community contributions are invited!

Microsoft hasn't even updated their web site to in indicate 3.5 was released. I'm not trying justify anything or scare you, just be aware of the actual situation of another project if you are going to move.

As I mentioned on GitHub I'm not working on a fix. I'd start with trying to reproduce the exception without any Castle libraries, just a simple .NET console app on .NET 4.6 with WCF. Look at the unit test I mentioned that fails and use the stack trace to see what calls you need to make to reproduce. If the defect is really in the WCF facility, Windsor or Castle Core we should be able to help get that sorted, but narrowing down the problem is going to be the first point of call because it looks like a problem in the runtime or FCL.

>>>>>>> To post to this group, send email to castle-pro...@googlegroups.com.
>>>>>>> Visit this group at
>>>>>>> http://groups.google.com/group/castle-project-users.
>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>>>
> --
> You received this message because you are subscribed to the Google Groups
> "Castle Project Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> To post to this group, send email to castle-pro...@googlegroups.com.
> Visit this group at http://groups.google.com/group/castle-project-users.
> For more options, visit https://groups.google.com/d/optout.



--

--
You received this message because you are subscribed to the Google Groups "Castle Project Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to castle-project-u...@googlegroups.com.

To post to this group, send email to castle-pro...@googlegroups.com.
Visit this group at http://groups.google.com/group/castle-project-users.
For more options, visit https://groups.google.com/d/optout.



--
Jono

--
You received this message because you are subscribed to the Google Groups "Castle Project Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to castle-project-u...@googlegroups.com.

To post to this group, send email to castle-pro...@googlegroups.com.
Visit this group at http://groups.google.com/group/castle-project-users.
For more options, visit https://groups.google.com/d/optout.



--
Jono

Jonathon Rossi

unread,
May 5, 2015, 6:39:50 AM5/5/15
to Castle Project Users
Thanks for the insight Hammett, wasn't aware the other teams weren't under the same umbrella as the fx team.

Milan Cerny

unread,
May 12, 2015, 5:05:57 AM5/12/15
to castle-pro...@googlegroups.com
Hi,
Our app is writen in .NET 3.5 and for some clients or with some our modules we require the app to run in .NET 4.0 runtime (in app.config by:
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
). 
The problem is only with 4.0 runtime. When we not force the app to run in 4.0 runtime, but let it run normally (in 2.0 runtime) everything works.

Dne pondělí 23. března 2015 15:23:46 UTC+1 Filip Kinsky napsal(a):

Matteo Migliore

unread,
May 12, 2015, 5:18:59 AM5/12/15
to castle-pro...@googlegroups.com
In fact Milan,

but if I use LINQPad to test the WCF script it works, but the line you reported is present in the LINQPad configuration file and also in our application.

In LINQPad it works, in out application doesn't.

Our application is written using .NET 4.0.

Any idea? 

Thank you.
Reply all
Reply to author
Forward
0 new messages