copy reference to XmlDocument

  • Thread starter Thread starter z. f.
  • Start date Start date
Z

z. f.

Hi,

i'm using VB.NET and creating an XMLDocument object inside a class.
i want to copy the reference to the object to a local variable using xmlList = MyObj.XmlObj
when xmlList is of type XmlDocument and MyObj.XmlObj also.
for some reason i get an empty reference (nothing) while the original object had real value.
why? must i use Close ( i don't want to - it's redundant )

please supply with information regarding this.

TIA, z.
 
It is a bit hard to diagnose your exact problem based on the information you
supply. I can only give a couple of wild guesses.

1. Do you expose the XMLDocument inside your class through a property
procedure? If so, you might check if there is a bug inside your property
procedure. Property procedure implementation that fails to return a
non-empty reference will cause behaviour analogous to what you describe.
2. You say nothing about the execution flow in which this behaves. At what
point do you know that the XMLDocument inside your class holds a non-empty
reference? At what point do you experience that an empty reference is
assigned to your local variable? Could it be that some other code (possibly
another thread?) has manipulated the internal state (that is, the
XMLDocument inside your class) in between these two points in time?

If this was way off target and you still have a problem, you may provide
some additional info?

Tor B?dshaug
tor.badshaug [//at\\] bekk.no.
 
well,
it was returned by a GET property, but should not have failed.
anyway i changed it to be returned as a ByRef parameter, and having no problems.
thanx.

It is a bit hard to diagnose your exact problem based on the information you
supply. I can only give a couple of wild guesses.

1. Do you expose the XMLDocument inside your class through a property
procedure? If so, you might check if there is a bug inside your property
procedure. Property procedure implementation that fails to return a
non-empty reference will cause behaviour analogous to what you describe.
2. You say nothing about the execution flow in which this behaves. At what
point do you know that the XMLDocument inside your class holds a non-empty
reference? At what point do you experience that an empty reference is
assigned to your local variable? Could it be that some other code (possibly
another thread?) has manipulated the internal state (that is, the
XMLDocument inside your class) in between these two points in time?

If this was way off target and you still have a problem, you may provide
some additional info?

Tor B?dshaug
tor.badshaug [//at\\] bekk.no.
 
Back
Top