Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6921401
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:16:19+00:00 2026-05-27T10:16:19+00:00

We have a web solution with mixed C# and VB.NET (3.5) projects (note: several

  • 0

We have a web solution with mixed C# and VB.NET (3.5) projects (note: several vb.net files do have Option Strict Off). Our code runs as modules inside DotNetNuke 4.8. Under certain conditions, our application will crash at the method:

System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteString

The abbreviated message in that exception is:

System.ArgumentException: "Error serializing value XYZ of type XYZ."
System.InvalidCastException: "Unable to cast object of type 'System.Int64' 
to 'System.String'"

Nowhere in the stack trace is our code, it’s just System code that ends up failing to serialize type XYZ from our code. This means I can’t hit a break point and debug which exact property of XYZ is the problem. The stack trace property is empty, but in the Message is a stack trace abbreviated as:

DotNetNuke.Services.Exceptions.PageLoadException: "Error serializing value 'XYZ' of type 'XYZ.'" 
  System.ArgumentException: "Error serializing value 'XYZ' of type 'XYZ.'" 
  System.InvalidCastException: "Unable to cast object of type 'System.Int64' to type 'System.String'. "
at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteString(NameInfo memberNameInfo, NameInfo typeNameInfo, Object stringObject)
// ...... etc.........
at System.Web.UI.Page.SaveAllState() 
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 
// --- End of inner exception stack trace

All relevant lines in this trace start with System.. The top lines are DotNetNuke. However, following the first answer’s suggestion I compiled the DotNetNuke (4.8) code myself and turns out that code just does Server.GetLastError, showing the InvalidCastException as the InnerException without any additional info on the actual value or property name being serialized.

The question then is: how do I discover which field and value the serializer is having trouble with?

A few related questions/problems that came to mind while researching this problem:

  • If I look at the Formatters.Binary part of MSDN I’d guess the ObjectWriter is internal for Binary (as suggested in the comments, red)?
  • How can .NET even at all fail at casting a Int64 to String? Rephrased: what value for a Int64 could potentially not be converted to a String? However, as pointed out in comments: Int64 can easily be converted to Strings, but Casting them is a different issue.
  • The Serialize method doesn’t announce this ArgumentException or InvalidCastException may occur (in the Exceptions section).

I tried investigating XYZ and types for properties in that class in ildasm to see any irregularities but couldn’t find any.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T10:16:20+00:00Added an answer on May 27, 2026 at 10:16 am

    Answering my own question, hopefully that will help anyone ending up here after a search query.

    The final answer was found in this SO question. I ended up using a trial version of the .NET Reflector (and the included Visual Studio 2010 plugin) to step into the mscorlib code. This allowed me to inspect the NameInfo for the property that was causing the InvalidCastException.

    In short, the answer was: use .NET Reflector (or a similar tool) to step into mscorlib.


    PS. While stepping into mscorlib was the answer to my problem posed in this question, there’s still an underlying problem which probably warrants a whole new SO question, once I grab enough info on it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have several web application projects in one solution. When I start debugging one
I have a number of XSLT files in my ASP.NET Web Application solution. Should
I have a web site solution (asp.net) that runs on a SQL server database.
I have a vb.net solution with a web reference to a webservice. Now I
I have a solution with 3 projects.One of UI (contains web pages) and one
I have a VS solution that contains 6 library projects and 1 web folder
I am using an asp.net 3.5 web solution with js which contains 2 projects
I have a Web solution which contains two projects ( A and B )
I have a web solution (in VS2010) with two sub-projects: Domain which holds the
I have a web solution that contains 5 class libraries and one asp.net web

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.