S
Sean Kirkpatrick
I've found a puzzle with my legacy app and my new .Net dll.
I have defined an abstract base class
Public MustInherit Class AbstractFoos
Inherits CollectionBase
Public MustOverride Sub Append(ByRef poField As ACIndex)
Public MustOverride Sub Delete(ByRef psName As String)
' other defs
End Class
I've defined a concrete class
Public Class ConcreteFoos
Inherits AbstractFoo
Public Overrides Sub Append(ByRef poField As ACIndex)
... stuff ...
End Sub
Public Overrides Sub Delete(ByRef psName As String)
... stuff ...
End Sub
End Class
Public Class Bar
dim moFoos as ConcreteFoos
public readonly property get Foos as ConcreteFoos
Get
return moFoos
End Get
End Property
End Class
So ConcreteFoos provides the implementations necessary, plus has all of
the nifty CollectionBase stuff, such as Count. Bar is the ultimate
provider of ConcreteFoos via the Foos property. So far, so good.
In my vb6 app, I create a Bar and try to access the Count property of
the Foos property - should work just fine.
dim myBar as new Bar
... add some Foos ...
debug.print "Count is " & myBar.Foos.Count
This ALWAYS returns 0, regardless of the number of ConcreteFoos actually
exist. However, if I do this
dim myBar as new Bar
... add some Foos ...
dim myFoos as ConcreteFoos
set myFoos = myBar.Foos
debug.print "Count is " & myFoos.Count
I get the correct number of ConcreteFoos.
I've rewritten the test code in .Net and it works correctly there.
Am I missing something obvious? Does this make sense?
As an aside, this is the app I was asking about earlier this morning vis
a vis debugging between VB6 and .Net IDEs. The simple test program as
well as my main legacy app both crash the IDEs when I try to step across
the IDE boundary, and also when I try to step into the .Net dll from the
the compiled executable.
I'm really puzzled. I wanna believe that this is problem with my code -
I can fix it if it is, but the fact that the code fails one way but
works the other makes me think there's something funny about the COM
Interop layer.
Thanks for any insights!
Sean
I have defined an abstract base class
Public MustInherit Class AbstractFoos
Inherits CollectionBase
Public MustOverride Sub Append(ByRef poField As ACIndex)
Public MustOverride Sub Delete(ByRef psName As String)
' other defs
End Class
I've defined a concrete class
Public Class ConcreteFoos
Inherits AbstractFoo
Public Overrides Sub Append(ByRef poField As ACIndex)
... stuff ...
End Sub
Public Overrides Sub Delete(ByRef psName As String)
... stuff ...
End Sub
End Class
Public Class Bar
dim moFoos as ConcreteFoos
public readonly property get Foos as ConcreteFoos
Get
return moFoos
End Get
End Property
End Class
So ConcreteFoos provides the implementations necessary, plus has all of
the nifty CollectionBase stuff, such as Count. Bar is the ultimate
provider of ConcreteFoos via the Foos property. So far, so good.
In my vb6 app, I create a Bar and try to access the Count property of
the Foos property - should work just fine.
dim myBar as new Bar
... add some Foos ...
debug.print "Count is " & myBar.Foos.Count
This ALWAYS returns 0, regardless of the number of ConcreteFoos actually
exist. However, if I do this
dim myBar as new Bar
... add some Foos ...
dim myFoos as ConcreteFoos
set myFoos = myBar.Foos
debug.print "Count is " & myFoos.Count
I get the correct number of ConcreteFoos.
I've rewritten the test code in .Net and it works correctly there.
Am I missing something obvious? Does this make sense?
As an aside, this is the app I was asking about earlier this morning vis
a vis debugging between VB6 and .Net IDEs. The simple test program as
well as my main legacy app both crash the IDEs when I try to step across
the IDE boundary, and also when I try to step into the .Net dll from the
the compiled executable.
I'm really puzzled. I wanna believe that this is problem with my code -
I can fix it if it is, but the fact that the code fails one way but
works the other makes me think there's something funny about the COM
Interop layer.
Thanks for any insights!
Sean