Re: vbs output to txt file

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



AL,

Yes, you have a good point. I guess I would have to see a specific real life
example to be able to express any further opinion. This debate is getting a
bit too theoretical for me.

Paul

"Al Dunbar" <AlanDrub@xxxxxxxxxxxxxxxxxxx> wrote in message
news:%23jiRnbUgHHA.4156@xxxxxxxxxxxxxxxxxxxxxxx
I think it likely that we may never resolve this until we run across an
actual situation that always behaves in exactly the manner you describe,
or, alternately, one that fails only under certain circumstances.

Look at it this way: Are you a good enough scripter/programmer to design a
COM object that will fail as you describe, but ONLY under certain
circumstances? Granted, you would probably have to purposefully use bad
technique. Regardless, if you could do it on purpose, then I would posit
that someone else could do it by mistake. If neither of us could do it,
however, that wouldn't prove that nobody could. And if somebody/anybody
could do it on purpose, then I'd suggest (again) that someone could do it
by accident.


/Al

"Paul Baker [MVP, Windows - SDK]" <paulb@xxxxxxxxxxxxxxxxxxxxxxx> wrote in
message news:%23vgOV1PgHHA.4156@xxxxxxxxxxxxxxxxxxxxxxx
Al,

I admit I might be pushing my personal views a little too much here.

I'm saying that the argument goes that some COM objects may have to be
released in a particular order. The only logical reason for this would be
that one depends on another (which may or may not be obvious to the
caller) but does not add a refence to its dependancy. In this case, if it
is going to fail when unloaded in the wrong order, it will alwyas* fail
and it will be fairly obvious what the problem is. You can then choose to
workaround it or to look at another solution.

Paul

"Al Dunbar" <AlanDrub@xxxxxxxxxxxxxxxxxxx> wrote in message
news:Ou2oIMIgHHA.588@xxxxxxxxxxxxxxxxxxxxxxx
If only it were that easy. Are you saying, then, that, if my script does
not crash as a result of some problematic COM object not cleaning up
after itself properly, that it will never crash that way under any
circumstances?

As an example, consider a simple MATH COM object that has methods for
doing arithmetic. It won't crash when trying to divide by zero if the
code I write that calls it simply never causes it to divide by zero.

/Al

"Paul Baker [MVP, Windows - SDK]" <paulb@xxxxxxxxxxxxxxxxxxxxxxx> wrote
in message news:OjApZxCgHHA.4156@xxxxxxxxxxxxxxxxxxxxxxx
Just don't set anything to Nothing ever. If you need to release things
in a particular order, you'll find out when it crashes. Then go find a
"real" COM server and use it instead ;) I don't see how you would
necessarily know which order to release them in anyway.

"Al Dunbar" <AlanDrub@xxxxxxxxxxxxxxxxxxx> wrote in message
news:%233mc8xqfHHA.3632@xxxxxxxxxxxxxxxxxxxxxxx
Thanks. Now all I need is a list of those COM servers written "poorly"
and those written "well" so I will only set variables to nothing when
it is actually necessary ;-)

/Al

"Paul Baker [MVP, Windows - SDK]" <paulb@xxxxxxxxxxxxxxxxxxxxxxx>
wrote in message news:e$tIQ$cfHHA.1220@xxxxxxxxxxxxxxxxxxxxxxx
Al,

You are correct, some poorly written COM servers may require you to
release related objects in a particular order. I touched on this in
another thread. You would have to know the correct order to release
the objects in, which may be reverse order. Or maybe not! As far as I
know, so far everyone who has said that they religiously set
variables to Nothing has not described a tactic for getting this
order right. They have merely said that they have to do it (in some
order) because if this issue. It doesn't quite add up.

(Of course, a COM object should itself have a reference to any other
COM object on which it depends so this doesn't happen).

Paul

"Todd Vargo" <tlvargo@xxxxxxxxxxxxxx> wrote in message
news:eyOuaHXfHHA.5052@xxxxxxxxxxxxxxxxxxxxxxx
Al Dunbar wrote:

"Paul Baker [MVP, Windows - SDK]" <paulb@xxxxxxxxxxxxxxxxxxxxxxx>
wrote in
message news:%23oEWE6FfHHA.4560@xxxxxxxxxxxxxxxxxxxxxxx
...
These objects are COM objects and reference counted through the
IUnknown.
Going out of scope is a decrement of the reference count. Just
because
it
is not obvious that VB or VBScript is doing all this magic for
you
doesn't
mean that it is not.

Agreed. But does hearing you say it does this magic mean that it
will
always
do the right thing in every possible instance? Are there perhaps
interactions and relationships between COM objects that would, for
example,
require them to be "released" in a particular order?

Seems logical that if objects are automagically released, one would
expect
the stack to be popped in reverse order of creation. OTOH, one can
always
test to avoid asking. {wink}

--
Todd Vargo
(Post questions to group only. Remove "z" to email personal
messages)















.



Relevant Pages

  • Re: vbs output to txt file
    ... COM object that will fail as you describe, ... Regardless, if you could do it on purpose, then I would posit ... not crash as a result of some problematic COM object not cleaning up ... the stack to be popped in reverse order of creation. ...
    (microsoft.public.scripting.wsh)
  • Re: Crash Gordon
    ... Crash has always been very helpful. ... Spelling & grammar errors are made on purpose for those who are ... fulfilled by correcting others. ... > Do U not have a job or a real life? ...
    (microsoft.public.frontpage.client)
  • Re: how is Haskell not robust?
    ... hardware failure possibly) will a program ever fail in an uncontrolled ... If it is allowed to fail at all, ... manner that does not impact on the provision of critical services. ... But a program crash because of an exhausted heap ...
    (comp.lang.functional)
  • Re: When the Hell.......................
    ... >>> provided were not fit for purpose. ... By supplying models and software not fit for purpose you fail ... I said I could render it 200 times faster than a high-end PC back in 1995 on a modern high-end PC. ...
    (rec.arts.drwho)
  • Re: When the Hell.......................
    ... implies that they met with your approval and *were* fit for purpose. ... By supplying models and software not fit for purpose you fail ... The purpose was to see if you could render in real-time as you'd ...
    (rec.arts.drwho)