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 6124077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:05:29+00:00 2026-05-23T16:05:29+00:00

We have a problem with deserializing an exception. I am fully aware that it’s

  • 0

We have a problem with deserializing an exception. I am fully aware that it’s a bad practice to send exceptions over the network but the current setup requires this for the integration of our systems to work.

The server system is a .net 4 wcf service and the caller is a .net 2 that calls the .4 using a standard web reference.

The server side simply serializes the exception and encodes it in a Base64 string.

      var formatter = new BinaryFormatter();
      var mem = new MemoryStream();
      formatter.Serialize(mem, ex);
      EncodedException = Convert.ToBase64String(mem.ToArray());

On the receiving end

      var formatter = new BinaryFormatter();
      messageChannel.ServerException = (Exception)
      formatter.Deserialize(new MemoryStream(Convert.FromBase64String(base64string)));

All is there except the TargetSite.

Any hints are greatly appreciated.

Thanks

Johan

  • 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-23T16:05:29+00:00Added an answer on May 23, 2026 at 4:05 pm

    Exception.TargetSite Gets the method that throws the current exception. According to MSDN:
    The TargetSite property may not accurately report the name of the method in which an exception was thrown if the exception handler handles an exception across application domain boundaries.

    Which makes sense since the return value can be assigned only if the TargetSite of the expetion exist on your remote code/application (and it probably doesn’t since it can be a different code/application).

    It is the same thing as to serialize a reflection of the C# object send it over network de serialize it and expect it to works as it worked on local site even if the reflected objects does not exist on the remote site. In short: reflection of the class without the class is nothing.

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

Sidebar

Related Questions

I have a problem deserializing a JSON string using Jackson (but I have no
I have problem in some JavaScript that I am writing where the Switch statement
I have problem with fancybox. I want to write a function that will run
I have a problem deserializing some XML; the XML supplied by a third party
I have an idea for how to solve this problem, but I wanted to
I have a problem with deserializing in C#/ASP.NET, which gives the exact error: The
I have some JSON that I am deserializing using Gson. { resp: { posts:
I have to deserialize JSON strings that I don't have any control over. This
I have problem with Activities navigation, searching works good. Activities hierarchy looks like that:
I have problem with passing variables through views. But, first some code // i

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.