Bug 7701 - It lies in the app.config at dataContractSerializer, "Cannot cast from source type to destination type."
Summary: It lies in the app.config at dataContractSerializer, "Cannot cast from source...
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: WCF assemblies ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2012-10-06 00:08 UTC by Meanbunny
Modified: 2012-10-11 14:13 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

The project in question. (31.22 KB, application/x-zip-compressed)
2012-10-06 00:08 UTC, Meanbunny

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report for Bug 7701 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description Meanbunny 2012-10-06 00:08:22 UTC
Created attachment 2697 [details]
The project in question.

I was trying to create a simple WCF service for testing on my Windows 7 machine in MonoDevelop. Once I got it up and running I decided to copy the same project onto my Ubuntu machine and run it. When I ran my WCF server, and got the following exception, "Cannot cast from source type to destination type.". After looking online for a solution I realized it was a generic error so I started digging around for different solutions. 

This service uses an app.config file for configuring its service endpoints that I had copied from another project of mine and modified for this one. I was able to finally figure out that it was related to the behaviorConfiguration of the service in the config, only by deduction.

<behavior name="serviceBehavior" >
  <dataContractSerializer maxItemsInObjectGraph="2147483647" /> <!--The problem lies here in this line-->
  <serviceDebug includeExceptionDetailInFaults="true" />

In my previous project I had to allocate for the maximum amount of items to be sent over the wire. Removing that line allowed my simple app to run, but just wanted to point it out for a bug report if it is one.

Oddly enough it worked on my Windows machine but not Ubuntu 12.04.
Comment 1 Zoltan Varga 2012-10-11 14:13:32 UTC
-> wcf.