.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Problem with serialization of objects

Posted By:      Posted Date: September 28, 2010    Points: 0   Category :WCF
When I try to return a collection (an List<>) of a complex kind of object (each one have about 20-30 custom objects inside) I get this error:

Test method SMILTest.ServiceManagerTest.PessoasTest threw exception:  System.ServiceModel.CommunicationObjectFaultedException: The communication object, System.ServiceModel.Security.SecuritySessionClientSettings`1+ClientSecurityDuplexSessionChannel[System.ServiceModel.Channels.IDuplexSessionChannel], cannot be used for communication because it is in the Faulted state..

Server stack trace:
   at System.ServiceModel.Channels.CommunicationObject.ThrowIfFaulted()
   at System.ServiceModel.Security.SecuritySessionClientSettings`1.ClientSecurityDuplexSessionChannel.TryReceive(TimeSpan timeout, Message& message)
   at System.ServiceModel.Dispatcher.DuplexChannelBinder.Request(Message message, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Obje

View Complete Post

More Related Resource Links

Cutting Edge: Binary Serialization of ADO.NET Objects


One of the key elements that makes ADO. NET superior to ADO is the level of integration with XML. In ADO, XML is just an I/O format. In addition, the ADO XML format is totally inflexible and doesn't allow any type of customization.

Dino Esposito

MSDN Magazine December 2002

Serialization and generics : problem with xmlinclude

Hello everyone. I've got a hierarchy of class like this: [Serializable] [xmlinclude(DiscreteDomain)] public abstract class Domain { } [Serializable] [xmlinclude(DiscreteDomain<>)] public abstract class DiscreteDomain : Domain { } [Serializable] public sealed class DiscreteDomain<T> : DiscreteDomain { } I can't serialize an object of type DiscreteDomain<T> because xmlinclude can't be used with a generics like DiscreteDomain<> (a type must be specified but i can't).   How can I serialize this type of object ?   Thx, JP

Problem binding business objects to custom user control properties

I have created a user control (supplierPicker) intended to allows a supplier database to be searched and a supplier selected. I want to be able to use this control in a number of other user controls, by binding the suppplierID property of the supplierPicker to a supplierID property in a business object, which is set as the datacontext of the parent user control. When I do this, and there is a supplierID specified in the business ofbject, the binding sets the supplierID in the supplierPicker control and it shows the correct supplier name in the textbox. However when the supplierID DependencyProperty is changed from within the supplierPicker the newly selected supplier name is shown in the TextBox, but the SupplierID does not propogate back to the business object. Other controls on the parent form work fine, so the binding to the business object seems to be ok. Any pointers as to what I'm doing wrong here would be grately appreciated.  This one has been driving me nuts for days! Snipped code for the supplier picker:         public partial class SupplierPicker : UserControl, INotifyPropertyChanged     {         public static DependencyProperty SupplierIDProperty;         public event PropertyChangedEventHandler PropertyChan

Problem when ajax enabled WCF Service returns EDM Objects

Hi there, Could you please help me with the following problem? - I have ajax enabled WCF service. It returns Customer Entity Type.  For example: [OperationContract]             public List<Customer> GetCustomers()        {            using (NorthwindEntities context = new NorthwindEntities())            {                return context.Customers.Take(10).ToList();            }        }  - But AJAX Client Library cannot display Customer( as Entity). I cannot see data in browser. Even it hits the breakpoint and returns 10 customers. - But if I make a plain class called "Customer2" with same fields and copy all the "Customer" into "Customer2" then it works. In this case I return List<Customer2>. Then it works like a champ and I can see customer in AJAX/DataView/List. - Why I need to create a class? Is this JSON problem? DataView accepts JSON data format. - I use VS2010, AJAX 4.0. - Do I need to add something else along with [OperationContract].   Regards, Rajan  

XAML Serialization Problem


I try to save (serialize) a XAML document. The background is that the user of the application should be able to change the XAML document dynamically.

This works fine with some basic controls but as soon as I have a datagrid inside the XAML, non of this works:

System.Windows.Markup.XamlWriter.Save throws:

Cannot serialize a generic type 'System.Collections.ObjectModel.ObservableCollection`1[Microsoft.Windows.Controls.DataGridColumn]'.

System.Xaml.XamlServices.Save throws:

Constructor on type 'System.ComponentModel.ComponentConverter' not found.

I already found in forum that XAML does not fully support generics, however, is there a solution for this? I'm a bit confused because if XAML can be read dynamically it should also be possible to save it...

I use .NET Framework 4.

Thanks for reply... any suggestion is very welcome.

Serialization Problem....



i am trying this code but its giving me "There is an error in XML document (0, 0)."

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using System.Text.RegularExpressions;
using System.Xml.Serialization;
using System.IO;

namespace GridViewPaging
    public class Person
        private string _name;
        private CNIC _cnic;

        public string Name
                _name = value;
                return _name;

        public string NIC
                _cnic.NIC = value;
                return _cnic.NIC;


    public struct CNIC
        private string _cnic;
        private bool _isValid;

        public string NIC
                if (IsCNICValid(value))
                    _isValid = true;
                    _cnic = value;
                    _isValid = false;
                if (

Activity field xml serialization problem


Hello,first of all I beg your pardon if my question could be out of topic, but I don't know where to address it. I'm working with 3.5 workflow foundation and I have a custom activity with a field of type DictionaryList, which is a serializable class containing some simple typed members, and a FeedbackItem[] member. FeedbackItem is a serializable class containing an ID (int), a Type (System.Type) and a Value (System.Object) fields. In the designer when I edit the custom activity, and I set the List Property (by using a PropertyGrid) i fill the DictionaryList class with all fields including the array of FeedbackItem. When I save the designer saves the workflow in a xoml file. When I load the xoml in the designer and I open the designer of the List property of the activity the DictionaryList object stored in previous session is missing the contrent of the FeedbackItem array; the FeedbackItems property has a FeedbackItem[0]. It seems like the xml serializer serializes the DictionaryList object but it can't deserialize it completely. Is there something I have to beware of? It's possible that some field in the FeedbackItem is not serializable and causes some error in deserialization process? I don't understand because il I edit the xoml file I can read the array like this:

    <x:Array Type="{x:Ty

Problem when doing a binary serialization from COM



I am trying to serialize an object using binary and I'm running into an error "Unable to load assembly". I tried creating a new SerializationBinder which loads the correct assembly however it returns an error "The object with ID 7 was referenced in a fixup but does not exist" (I also received the same error but with ID 6).

My code runs in the following way:

A COM visible dll is launched from a VB6 application. This DLL has a reference to a .NET dll which contains the data objects and performs the serialization.

However, If add a new Windows Forms application to the solution, and call the same methods using the same data objects deserialization works without any issues, and no need to reset the binding.

Thank you

Problem to group radio button across gridview rows

In general no one can easily group or make a single selection from radio button list inside gridview rows. There are a lot of way to make a single or unique selection from list. Here i want to share how i can address this problem in the most easiest way. Googling the problem most of the cases i saw the grouping in horizontal way. Thats why i tried to group the radio buttons in vertical manner. Let i have a requirement like below:

Regrading Sharpoint 2010 problem and solutions

We can write your question and problem on this blogger.you get ans.use.

This sharpoint 2010 problem solving threads

Hi friend,

you can use this thread to solving problem and solutions.

Virtual Path Problem


 I get the following error on last line below (working on remote host): 'E:\web\sfcascom\ls_admin/uploads/images/001.JPG' is not a valid virtual path,

Note that the slashes go in different directions

I've tried a number of things but nothing seems to work. Thanks-


Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Drawing.Imaging
Imports System.Web.UI.WebControls

Imports System.Drawing.Imaging.ImageCodecInfo
Partial Class Protected_imageupload
    Inherits System.Web.UI.Page
    Private Sub btnUpload_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUpload.Click
        ' Initialize variables
        Dim sSavePath As String
        Dim sThumbExtension As String
        Dim intThumbWidth As Integer
        Dim intThumbHeight As Integer
        Dim sFilename As String = ""
        ' Set constant values
        'sSavePath = "images/"
        sSavePath = Server.MapPath("~/") + "ls_admin/uploads/images/"

        sThumbExtension = "_thumb"
        intThumbWidth = 160
        intThumbHeight = 120

        ' If file field isn?t empty
        If FilUpload.PostedFile IsNot Nothing Then
            ' Check file size (mustn?t be 0)
            Dim myFile As Http

Strange Photo upload problem


I'm working project it's live on shared hosting

we'er uploading photos to a file on the server everything works fine the photo is resized renamed and sent to the folder

the upload page returns the thumbnail and the full size photo it's there all the photos have to be approved by an admin

twice now after they have been approved they disapear I checked the folder they are not there could there be anywhere

on the server they could get hung up before they go into the folder I have it setup so when you delete the data base entry it deletes the photo from the folder othe than that you need to open the folder and delete the photo this has hapened twice now I tried to recreate it with no luck

thaks for your help in advance

ASP.Net Caching problem ??


I'm having a problem with an asp.net 3.0 application using a gridview to display data.  The problem seems to be that despite a brand new .selectCommand being sent to the sqlDataSource, the gridview starts displaying data from *someone else's* query.  For example, user A is logged in and will be working fine until a few page submissions later when the gridview data starts suddenly showing information that belongs to another user. 

This is my first asp.net application, though I've been working with classic asp and ADO for years so I'm used to sending a SQL string and getting back the results from that string.  Apparently there is a complex caching system which is interferring which I do not at all understand so at this point I just want to stop the server from caching any data whatsoever.  Is this possible?

Any and all help will be much appreciated!!

Could some one tell me whats the Problem with this String Manipulation ??? C#.net



I store some values from code behind to a label which is Hidden !

<asp:Label ID="lbl_Hidden" runat="server" Visible = "false"></asp:Label>

and at the page load event i retrieve the value of the label & assign it to a string !

stringvalue = lbl_Hidden.Text;

Now i dont know why this manipulation does'nt work !

I've a character 'A' in the string and i'm unable to replace it with a space !

stringvalue.Replace(A, " ");

Wot do u think abt it ????

Need help with objects and arrays


I have an objuct that I declared like this:

    Class DailyStats
        Dim _day As String
        Dim _hour As String
        Dim _impressions As String
        Dim _clicks As String
        Property Day() As String
                Return _day
            End Get
            Set(ByVal value As String)
                _day = value
            End Set
        End Property
        Property Hour() As String
                Return _hour

RaiseEvent problem


I have a parent page ProdView.aspx and two static UserControls, UC1 and UC2. Each UC is in an Ajax accordion pane and the accordion inside an updatepanel.

UC1 has a Gridview footer with couple of textboxes and a link button that fires an Add Row insert procedure. I want to Raise an event that will rebind the UC2 after the row insert in UC1.

First I created the sub delegate and event in UC1:

  • Public Delegate Sub MyRefresh(ByVal sender As Object, ByVal e As CommandEventArgs)
  • Public Event Refresh_UC1 As MyRefresh

In the same UC1 the Insert procedure that fires the insert and RaiseEvent:

Sub PricingGrid_Insert(ByVal sender As System.Object, ByVal e As EventArgs)
       Dim myConn As SqlConnection = New SqlConnection(ConfigurationManager.ConnectionStrings("LocalSqlServer").ConnectionString)
       Dim myCom As SqlCommand = New SqlCommand("AddRow", myConn)
       myCom.CommandText = "AddRow"
       myCom.CommandType = CommandType.StoredProcedure


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend