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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T04:09:22+00:00 2026-06-01T04:09:22+00:00

I have a pecular problem in my WCF in the web services layer. When

  • 0

I have a pecular problem in my WCF in the web services layer.

When I instantiate a private member (_Wagon) of my class (This instantiation is not null) in WCF, after few seconds, it’s become null.

I’ve been trying to diagnose the problem, but no result so far.

So I’m turning to you people to help me solve this problem.

Thank you.

Hence there is my code :

[DataContract]
public class RemoteWagon
{
    private readonly IWagon _Wagon;

    public RemoteWagon(IWagon Wagon)
    {
        _Wagon = Wagon; //_Wagon isn't null here
    }

    ~RemoteWagon()
    {
        Trace.WriteLine("Do nothing");
    }       

    [DataMember]
    public RemoteBreakpoint Breakpoint
    {
        set
        {
            if (value == null)
            {
                _Wagon.Breakpoint = null; //_Wagon member is NULL...
            }
            else
            {
                //... useless code in this context.
            }
        }
    }       
}
  • 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-06-01T04:09:23+00:00Added an answer on June 1, 2026 at 4:09 am

    This would happen if your class had been serialized and deserialized by DataContractSerializer (for example when sending data between client and server)

    Some reference: DataContractSerializer doesn't call my constructor?

    If this is the case, then one possible solution, that worked for me: https://stackoverflow.com/a/9419943/724944

    So a quick check&fix for this problem (I assume that you want to initialize the field yourself and not serialize it) would be to create method:

    [OnDeserializing]
    private void OnDeserializing(StreamingContext c)
    {
        _Wagon = initializeWagon();
    }
    

    however, as you probably noticed, you won’t be able to pass Wagon during deserialization – you’ll have to initialize it differently.

    On the other hand, If you want _Wagon serialized, then expose it as public [DataMember] property

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

Sidebar

Related Questions

I have a very peculiar problem:(not using web.config) DefaultFacebookApplication dfa=new DefaultFacebookApplication(); dfa.AppId = ...;
I have a peculiar problem. I created a normal Objective C class called SampleTable.
have a peculiar problem with hibernate. I have a hibernate function like this. @SuppressWarnings(unchecked)
I have a peculiar problem when calling a web service that expects the message
I have a class Test with a peculiar data structure. A member of class
I'm facing this peculiar problem in my silverlight app. I have a Canvas that
I have a very peculiar problem and my last resort was asking this on
I have a peculiar problem, which I think that a lot of other people
I have a little demonstration below of a peculiar problem. using System; using System.Windows.Forms;
I have a peculiar problem. I am loading a JSON file that contains the

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.