chrisstoyles's posterous

Problem: .NET COM Interop Events

I've come across a strange problem that I can't seem to solve. I've written a .NET class library for downloading files from the web and exposed it as a COM object. It is asynchronous and exposes events which fire on progress etc. so that any third party application using this library can display download progress in its own way. The problem occurs when I register this library on a production machine using a command similar to this:
"RegAsm.exe /register WebLib.dll"

3rd party applications can subscribe to the events I have exposed however as soon as my library attempts to fire any event, the following System.Reflection.TargetException occurs:
"object does not match target type".

As soon as I re-register the class library like this (with the /tlb command) then everything works perfectly:
"RegAsm.exe /register WebLib.dll /tlb"

If any .NET gurus stumble upon this post and have an idea as to why this might be happening I would love to hear from you!

Chris.
Filed under: .NET helpme

ZCML for Storm under Zope3

This was a rookie error, but if you're trying to define the URI to your Sqlite database as an absolute path, don't do this:
<store name="db" uri="sqlite:///var/tmp/test.db"/>
Do this:
<store name="db" uri="sqlite:////var/tmp/test.db"/>

You need the four (4) forward slashes, the two at the beginning separate the schema name from the rest of the URI, the second one separates the host name, username, and password information, and the third one the actual database name (in this case, a path to our sqlite file).

Hope someone else finds this helpful.

11
To Posterous, Love Metalab