Home » .NET, WCF, Web » WCF Custom tool error: Failed to generate code for the service reference.

WCF Custom tool error: Failed to generate code for the service reference.

Very recently, building multi-tier application involving Silverlight front-end inter-operating with WCF back-end, I encountered very odd, yet annoying behaviour of Visual Studio 2010. I was building new functionality using Telerik RadMap for Silverlight control that was to display some spartial data supplied by WCF service. To achieve this my Silverlight application had to reference few Telerik assemblies (Telerik.Windows.Controls.DataVisualization.dll). What is important is fact, that Service Reference for WCF service had been there already, project built and everything was working nicely, until I added extra method to WCF. After using “Update Service Reference” VS command, I started getting following error.

WCF error Screenshot no.1

Lack of further details with regards to this error and appropriate feedback from Visual Studio certainly does not help to get to the bottom of the problem, however after some investigation it turned out that one of Telerik assemblies caused this problem. When VS2010 creates service reference, default settings are that it should “reuse” all available types in reference. Excluding certain types from serialization allows service reference to be added successfully.

WCF error screen 2

I hope this helps anybody who got stuck with this problem.

Tags: ,

18 Responses to WCF Custom tool error: Failed to generate code for the service reference.

  1. Tank You it’s Works. TANK YOU

  2. Thanks for the post, worked for me!

  3. Hats Off!!!

  4. You’re a lifesaver. Thank you!

  5. Awesome.. this worked for me .. Thanks :)

  6. That didnt work for me.
    I do not use the Telerik.Windows.Controls.DataVisualization dll and get the error.
    Are there other solutions?

  7. This also happened for the Newtonsoft.JSON assembly. There should be a warning in the error list that tells you which assembly is causing the issue

  8. Beware about the dlls versions too.
    I’ve lost many hours until guess the SharpArch dll version in the client was different of the version in the WCF Service.
    Excluding this assembly from reuse, everything runs good.
    Thanks for help!

  9. Matt… I love you. You saved me…..thanks

  10. Great!

    I thought, that this is gonna be my personal „End of the World“. :-)

    Thank you for your Post it saved me the evening.

    Regards
    Marcel

  11. Thank you so much Matt.
    But a question here is why this time I get this error? Im always using Telerik controls. How did you know the problem is Telerik.Windows.Controls.DataVisualization.dll

  12. Thanks for this useful article.

    In my case, i have this issue with my WPF project in VS.Net 2008. After going through this article, i was realizing that the assembly used in the web service is different version of assembly used on client.

    It works just fine after update assembly on the client.

  13. Thanks it’s work !

    For me I just unchecked “Oracle.DataAccess”

  14. Thanks Man!!!

  15. Thank you.

    That fixed about 15 warnings and a few errors, compiles fine now.

  16. that didn’t work for me .
    i m having visual studio 2013 and 4.5
    i m unable to get Telerik.Windows.Controls.DataVisualization and i have unchecked Newtonsoft.JSON also but it is not working for me

    please help me on this

Leave a Reply

Your email address will not be published. Required fields are marked *

*


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>