Home All Groups Group Topic Archive Search About

Run-time Error 430, WITH non-broken binary compatibility?

Author
27 Feb 2007 9:04 PM
tendim
I've been building a DLL to use as a library against which a small
number of appliations is built.  Everything has been working fine, up
until today.

One class in the library is a FormFactory.  The form factory returns
pre-created forms.  I've got an Enumeration defined, such as:

-----
Public Enum EFF
  EFF_Main = 0
  EFF_Login = 1
End Enum
-----

And a function in FormFactory:
-----
Public Function createForm(byval p_eForm as EFF) as IMyForms
  Select Case p_eForm
   ...
  End Select
End Function
-----

And finally, an interface, IMyForms, with a single function:
-----
Public Function showForm() as Integer
-----

In this way, I can create forms from the DLL and show them to the
user, with code such as this:
-----
Public Sub Foo()
  Dim oMyForm as IMyForms
  Dim oFactory as FormFactory
  Dim iExitStatus as Integer

  Set oFactory = new FormFactory

  Set oMyForm = oFactory.createForm(EFF_Main)

  iExitStatus =  oMyForm.showForm
-----


(of course, all of my forms implement the IMyForms interface in their
code segment).

This code has been working fine for months.

So today I found a bug in one of the forms, and went to fix it.  I did
*not* add any public members, functions, subroutines, or change *any*
signatures.  All of the code I changed was labeled as Private code,
tied to control and form events.  For example, in the Form_Unload()
event I increase a counter, and I changed that code.. So it went from:

-----
Private Sub Form_Unload(Cancel as Boolean)
  c_iMyValue=0
End Sub
-----

To:
------
Private Sub Form_Unload(Cancel as Boolean)
  c_iMyValue=-1
End Sub
-----

However, when I compile the DLL and install it, suddenly I get the
dreaded Error 430: Class does not support Automation or does not
support expected interface.

Now, I've got binary compatibility turned on, and nothing "public" has
changed.  But I still get this error.  If I role back to the previuos
version of the DLL, then the application works fine (albeit with the
original bug that I was trying to fix in the first place).

Does anybody have any idea what could be happening here?

One more thing.  Say the previous version of the DLL is 1.1 and the
new version is 1.2.  If I re-compile the app against 1.2, it works
fine, but then if I role back to 1.1, the app breaks again.  Same vice-
versa: compile against 1.1, upgrade to 1.2, broken.  But if I haven't
changed anything, and I get no warnings about breaking compatibility,
I was under the impression that having binary compatibility would
allow me to use either 1.1 OR 1.2 with the app, *regardless* of the
version that it was compiled against.

Thanks for *any* help in this!

-10d

Author
27 Feb 2007 9:17 PM
Ken Halter
"tendim" <ten***@gmail.com> wrote in message
news:1172610250.977521.128520@p10g2000cwp.googlegroups.com...
>
> Does anybody have any idea what could be happening here?

It sounds like the binary compatibility model wasn't kept up to date. It's
very easy to forget to update after adding a new public interface.

Here's a little bit about that...
http://www.vbsight.com/BinaryComp.htm


> One more thing.  Say the previous version of the DLL is 1.1 and the
> new version is 1.2.  If I re-compile the app against 1.2, it works
> fine, but then if I role back to 1.1, the app breaks again.  Same vice-
> versa: compile against 1.1, upgrade to 1.2, broken.  But if I haven't
> changed anything, and I get no warnings about breaking compatibility,

You don't need to change anything or break compatibilty. All you have to do
is forget to update the model after adding something new. If you add
something new, VB generates a new interface ID for that item. If you forget
to update the compatibility model, VB will regenerate this new ID each time
you compile, without telling you that something's wrong.

> I was under the impression that having binary compatibility would
> allow me to use either 1.1 OR 1.2 with the app, *regardless* of the
> version that it was compiled against.

Nope... when you compile with a newer version, the app wants that newer
version.

> Thanks for *any* help in this!
>
> -10d




--
Ken Halter - MS-MVP-VB - Please keep all discussions in the groups..
In Loving Memory - http://www.vbsight.com/Remembrance.htm
Author
28 Feb 2007 1:21 PM
tendim
On Feb 27, 4:17 pm, "Ken Halter"
<Ken_Halter@Use_Sparingly_Hotmail.com> wrote:
> "tendim" <ten***@gmail.com> wrote in message
>
> news:1172610250.977521.128520@p10g2000cwp.googlegroups.com...
>
>
>
> > Does anybody have any idea what could be happening here?
>
> It sounds like the binary compatibility model wasn't kept up to date. It's
> very easy to forget to update after adding a new public interface.

Again, *NOTHING* was changed on the public end.  No public members
were changed, no function or subroutine prototypes, absolutely
nothing.  All code changes (in fact, only two lines of code, total)
were made in private subroutines which represented events of form
controls.

> Here's a little bit about that...http://www.vbsight.com/BinaryComp.htm

Yup, read that one a long time ago, that's how I first learned about
this stuff.
Author
28 Feb 2007 3:07 PM
Ken Halter
"tendim" <ten***@gmail.com> wrote in message
news:1172668887.235315.288550@8g2000cwh.googlegroups.com...
>
> Again, *NOTHING* was changed on the public end.  No public members
> were changed, no function or subroutine prototypes, absolutely
> nothing.  All code changes (in fact, only two lines of code, total)
> were made in private subroutines which represented events of form
> controls.
>
>> Here's a little bit about that...http://www.vbsight.com/BinaryComp.htm
>
> Yup, read that one a long time ago, that's how I first learned about
> this stuff.

If nothing at all changed, why did the typlib version get incremented? You
can download a ComGuard demo (fully functional) and use that to compare the
2 components. It'll show the differences. Either way, once the typelib
version changes and you compile something against that new version, you can
no longer use the older component, with that specific app. The older
component should still work with any previously compiled apps.

--
Ken Halter - MS-MVP-VB - Please keep all discussions in the groups..
In Loving Memory - http://www.vbsight.com/Remembrance.htm
Author
28 Feb 2007 3:15 PM
Ken Halter
"Ken Halter" <Ken_Halter@Use_Sparingly_Hotmail.com> wrote in message news:O%
> can download a ComGuard demo (fully functional) and use that to compare
> the

forgot the link
http://www.vbsight.com/ComGuard.htm

--
Ken Halter - MS-MVP-VB - Please keep all discussions in the groups..
In Loving Memory - http://www.vbsight.com/Remembrance.htm