.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

binary serialize weird error

Posted By:      Posted Date: August 28, 2010    Points: 0   Category :.NET Framework
i got this class, when i wanna serialize it, i keep getting error System.Runtime.Serialization.SerializationException was unhandled by user code   Message=Type 'System.Linq.Enumerable+WhereSelectListIterator`2[[Data.Models],[System.Int32, mscorlib, Version=, ...' in Assembly 'System.Core, Version=, ... is not marked as serializable. [Serializable] public class XXX : ... { public IEnumerable<int> CardFilters { get; set; } //public void RequeryCardFilters() //{ //} public void RequeryCardFilters() { this.CardFilters = null; ... //IEnumerable<Data.Models> var rslt = RFDataViewModelFactory.GetReportCardFilters(this.Identifiers, this.PostcodeFrom, this.PostcodeTo, this.LastContactBefore, this.RecontactBy, this.SelectedCardType); ... IEnumerable<int> rsltIds = from i in rslt select i.Id; } } you can see inside the RequeryCardFilters(), i only play with 3 data/var, 1 of them is local public prop, the other 2 are local var. If you remark this out, and just use an empty method, it worked fine. what can cause the serialization to fail? IFormatter formatter = new BinaryFormatter(); MemoryStream memStrem = new MemoryStream(); formatter.Serialize(memStrem, myObj);

View Complete Post

More Related Resource Links

Weird security configuration error message


Recently something has gone wrong with our website so that whenever you try to access an aspx file, it shows the following error:


Server Error in '/RALSWeb' Application.

Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Access is denied: 'RalsWeb'.

Source Error:

Line 256:                <add assembly="System.EnterpriseServices, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
Line 257:                <add assembly="System.Web.Mobile, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
Line 258:                <add assembly="*"/>
Line 259:            </assemblies>

IE 7 Weird error


NOTE: In firefox or Chrome not an issue, but in IE it just has become one.


<span  id="titleGannAngles" runat="server" >Title goes here</span>

Javascript global variable

var ogannangles = '<%= titleGannAngles.ClientID %>';

Js code in a function

document.getElementById(ogannangles).innerHTML="Object: Gann Angle,Grid,Arcs"+des;

It renders like this:      document.getElementById('ctl00_ContentPlaceHolder1_Chart_Volume1_Chart_Objects_Settings1_Chart_Objects_Edit1_titleGannAngles').innerHTML="Object: Gann Angle,Grid,Arcs"+des;

YET IE 7 gives me the error on this line:

document.getElementById(ogannangles).innerHTML="Object: Gann Angle,Grid,Arcs"+des;

That object is NULL or not an object ???

Why ???

a very weird error wsDualHttpBinding...HELP !!!!!

hi all, Created a wcf application,and now enhancing its features ,makes me to use wsDualHttpBinding as callbacks are included.Before my application worked well on BasicHttpBinding,but nw on wsDualHttp its giving an old error when i run my client and try to connect or cal a wcf method.. that error is: "HTTP could not register URL http://+:80/Temporary_Listen_Addresses/4f044c47-0774-4358-bfca-7fe1fcbfadf2/ because TCP port 80 is being used by another application." i referred 100 of forums n articles but in vain.I also tried including ClientBaseAddress in app.config on client side.,but no use....i really dnt understand what the problem is n how do i solve it..plz do give me some clear solutions so dat i proceed with my wrk.. Waiting for response Mumtaz Mumtaz Surani

Weird casting error (storing Generic list in Session)


Am trying to store a generic list in Session to act as a simple shopping cart. Am getting a weird casting error when I try and retrieve it from Session.

A critical error has occurred.
[A]System.Collections.Generic.List`1[MyCartItem] cannot be cast to [B]System.Collections.Generic.List`1[MyCartItem].
Type A originates from 'mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089'
    in the context 'LoadNeither' at location 'C:\WINDOWS\assembly\GAC_32\mscorlib\\mscorlib.dll'.
Type B originates from 'mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089'
    in the context 'LoadNeither' at location 'C:\WINDOWS\assembly\GAC_32\mscorlib\\mscorlib.dll'.

I have a class variable defined:

List<MyCartItem> _cart;

In the Load event I have:

_cart = (Session["MyCart"] != null) ? (List<MyCartItem>)Session["MyCart"] : new List<MyCartItem>();

Error (no data returned) when ResponseFormat:=WebMessageFormat.Json and attempting to serialize an I


I have am having an issue when attempting to return JSON data from a WCF Service.  I have tracked the issue down to the ResponseFormat:=WebMessageFormat.JSON, but I am unable to make any further progress.  


I am wanting the return types of my service to be an interface so that I have a little more control over the responses that are coming to my application.  

I know that returning an interface requires the ServiceKnownType and requires KnowsType on the objects so that they can serialize properly.  I have an example working, however, when add a property with a class that inherits from iList things go bad.  The service returns nothing.  I have confirmed via Fiddler that the content-length of the response is 0.  However if I switch the ResponseFormat to WebMessageFormat.XML it works fine and all objects are returned.  I have included as much code (and probably more) as I think is necessary.  If something else is needed, let me know. 

Any insight is greatly appreciated.


Code Notes:

If you comment out the DataMember Attribute on the Values property in TestResult class you will see that the code works perfectly when returning JSON. 

If you change the return Type of the Values Property to be TestCollection instead of ITestCollection it works as well.  

its showing weird binary data from the BDC data column in list

Hello Gentlemen,

Here I am experimenting the BDC with a simple example of pulling distinct data from a sql server 2005 to a sharepoint list column "SELECT distinct Color FROM Product" .


when i configured the bdc using Business Data List the data showing correct. But when I use this it in a list column with bdc data type its returnig me the binary type of data.
No exact match was found.

However in the bdc picker the data is displaying properly. The data type in sql is nvarchar. I tried changing different data types but its showing the same kind of it.

Here is the BDC:

Error Message: String or binary data would be truncated. The statement has been terminated




I have the following problem.

When I edit a field in the SQL Server Management Studio Express then I get the following error:

Error Source: .Net SqlClient Data Provider
Error Message: String or binary data would be truncated.

The statement has been terminated


When I use the SQL update commando, it works fine.

Fore debugging we need to change the enabled field several times.

Is there a solution fore this?



The Table Layout

USE [Project]


/****** Object: Table [dbo].[Proces] Script Date: 06/02/2008 10:01:20 ******/

Weird error message



Regel 1:  @using System.Globalization;
Regel 2: 
Regel 3:  @{
Regel 4:      Layout = "@Href("~/Shared/_Layout.cshtml")";
Regel 5:      PageData["currentFractal"] = "Mandelbrotset";
Errormessage: Line 3!
Parser-foutbericht: The code block is missing a closing "}" character.  Make sure you have matching "}" character for all the "{" characters within this block and that none of the "}" characters are being interpreted as markup

 How can I get an error message like this on line 3, is this an error which was caused by another page? This puzzles me.

Serialize Strong Typed Collection. "There was an error reflecting type.."



I have a class that looks like this:


public class NewsItems : System.Collections.Generic.List<NewsItem>



Any it works just fine for 99% of my needs... Here is the 1% problem, when I want to write out the contents of my collection to XML, I get the following error (pasted below) anyone know how to remedy this?

System.InvalidOperationException was unhandled
  Message="There was an error reflecting type 'NewsItems'."
       at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel model, String ns, ImportContext context, String dataType, XmlAttributes a, Boolean repeats, Boolean openModel)
       at System.Xml.Serialization.XmlReflectionImporter.ImportElement(TypeModel model, XmlRootAttribute root, String defaultNamespace)
       at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(Type type, XmlRootAttribute root, String defau

Groove and Sharepoint Workspace 2010 - error during binary file store initiatlization.


I had groove and now have sharepoint workspace.   I had groove get hung up for a couple of hours and finally shut down my computer.   I got a "error occured during binary file store initialization" message.   I tried deleting and clean up all of the groove files but no luck.   I now have Sharepoint Workspace.  The message I get is "SharePoint Workspace is unable to continue because an error occurred during binary file store initialization."   Any coaching is appreciated. 

Error 8132:String or Binary data would be truncated. - Error only occurs when running execution of S

I have a Stored Procedure that I can execute from SQL Mgmt>New Query and running the exec statement and all is well. However, I have the same statement in a automated SQL Agent Job that the first step creates the Stored Procedure, second step executes Stored Procedure and then various other steps afterward. However, the job worked fine for a while and now the job dies at the second step each time. If I copy and paste the command for the second job in a new query manually, it works fine and the rest of the steps can process. Is this a bug?

Extremely weird error (stored proc)


Hi guys


We're getting a very weird error:

The stored procedure '***********' doesn't exist.

The solution to this may seem obvious but it's not. The website runs fine but with use and some traffic it starts popping up with this error on all pages accessing the database. While it's doing this, the stored proc(s) are there and they run fine via managment studio. Restart the website in IIS and it's fine again.

I have run a trace while this is happening and funny enough the specific proc doesn't show up in the trace at all.

This is happening on our dev and qa environments. Both running SQL2008 and IIS7.


Anyone else experienced this and have a solution for me please?



sql 2005 merge replication replicate 65 GB binary and cause "MSSQL_REPL20216 due to OS error 2"



We're using sql 2005 ent merge replication (SP2) and replicate 65GB binary data. However, after merge job running around 60 hours and nearly finished, it has the error messages like this :

From distribution.msrepl_errors and distribution.msmerge_history:

"The merge process was unable to deliver the snapshot to the Subscriber. If using Web synchronization, the merge process may have been unable to write to the message file. When troubleshooting, restart the synchronization with verbose history logging and specify an outfile to write" (Error Number: MSSQL_REPL-2147201001)

"The process could not read file "E:\Program files\Microsoft SQL Server\MSSQL.1\MSSQL\ReplData\unc\IMDNACMPS33_MPSERVER_MPSERVER\20110411220596\NoticeInfo_2.cft" due to OS Error 2(Error Number: MSSQL_REPL20216)


Please note that the above messages kept continuously appear in both event viewer and system tables between 1 minutes. Any suggestions or help to fix this?? Do I need to click 'stop synchronizing' and click 'start synchronizing' to restart the merge job again or click 'reinit subscription'? An urgent response is indeed necessary for this case. Thanks a lot.

Thanks and regards,

P.S: for your reference please find the attached error photo

Weird error when creating a site from a feature receiver


Hello everybody

I'm writing a feature in a sandboxed solution (scope of the feature : Web)

I've added to that feature a feature receiver that is supposed to create a subsite in the site in which it has been activated.

Here is the code

public override void FeatureActivated(SPFeatureReceiverProperties properties)
      string url="";
      using (SPWeb site = properties.Feature.Parent as SPWeb)
          site.Title = "root";
          SPWebTemplateCollection webTemplates = site.Site.RootWeb.GetAvailableWebTemplates(site.Language);
          url = site.IsRootWeb ? "subnews" : site.ServerRelativeUrl.Substring(1) + "/subnews";
          SPWebTemplate webTemplate = (from SPWebTemplate t
                         in webTemplates

IsapiModule Error 500 Issue


I am about exhausted trying to figure out this error:

HTTP Error 500.0 - Internal Server Error

Description: The page cannot be displayed because an internal server error has occurred.

Error Code: 0x8007007b

Notification: ExecuteRequestHandler

Module: IsapiModule

Requested URL: http://localhost:80/ReportServer

Physical Path: c:\Program Files\Microsoft SQL Server\MSSQL.2\Reporting Services\ReportServer

When I enable Failed Request Tracing Rules and view the log output I am supposing that the actual problem is in the 2nd call where there are 2 backslashes before the actual filename in the specified path:


CALL_ISAPI_EXTENSION DllName="C:\Windows\Microsoft.NET\Framework\v2.0.50727\\aspnet_isapi.dll"


Handling 404 page not found with Error page



      How do i handle 404 page not found?

Inserting personal error message in ValidationSummary



I am creating a web form that requires a lot of validation. I use many of the validation control in asp.net already like RequiredFieldValidator and CompareValidator. 

My Problem: after my custom validation for the value entered return an error message, and I pressed enter key when the field is empty, my custom error message is overlapped by my ValidationSummary. 

Setting my custom error to visible = false on button click also does not seem to work as it requires for me to enter the value first.

This made me think, is there a way to insert my custom validation inside the ValidationSummary as an error message like for other validation control?

Thanks in advance

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