VS.NET and PPC Custom Controls

From: Derrick (derrick_dunne_at_hotmail.com)
Date: 06/28/04


Date: Mon, 28 Jun 2004 09:15:38 -0230

My project is a set of custom controls for the Compact Framework. Some of
my controls implement an interface that I created; this interface and the
control implementation live in seperate assemblies. My problem is that when
I try to edit one of the properties of my control in a custom UITypeEditor,
I've been getting an "Invalid Cast Exception"

 As I'm sure you are all aware, controls for the Compact Framework require
having 2 "mirrored" projects; one full-framework version for design time,
and one strictly compact framework for runtime. Because of this, I have the
interface, implementation (the control itself), and UITypeEditor (this is
where the cast from an Object datatype to the interface type actually
occurs, and the exception is thrown) all in separate DLLs. I have them all
building into the same directory (say, "\Build"). I verfied that the object
in the driver is actually the right type.

What is happening is that when I add my controls to the toolbox in VS.NET
2003 in a test application, a reference to the interface DLL (taken from the
\Build directory) is added to the test project - this is expected behaviour.
I noticed that a property of the control (the definition of this property is
in the same DLL as the interface) is disabled unless I place a copy of the
interface DLL into the C:\Program Files\Microsoft Visual Studio .NET
2003\Common7\IDE\ directory (I figured this out using Filemon). This leaves
me with multiple definitions of the interface (one from the \Build, as
referenced by the test project, and one from that VS.NET directory, which I
have no idea why it is required), so now I understand why I am getting the
Invalid Cast exception when the UITypeEditor is run.

If I change my output directory from \Build to the VS.NET directory (and
change the references accordingly), I no longer get the exception - because
there is no DLL duplication. Ugly, yes; but it works.

Does anyone know why it requires the DLL in that VS.NET directory? That is
the only directory that VS.NET scans looking for that DLL - not the \BUILD
directory at all. I verified this using Filemon as well.

Thanks for any input you may have,

Derrick



Relevant Pages

  • Re: Unsafe Names for HTML Form Controls
    ... controls, not just input elements. ... The DOM specification says that a form encompasses behavior of a collection. ... the ECMAScript bindings documents make assertions about the mapping of bracket notation property accessors to collection interface methods. ...
    (comp.lang.javascript)
  • Re: Using GUI Scripting for automated testing?
    ... interface in cases where no other tool will function. ... "see" the GUI controls on the screen could operate these ... Isn't it also obvious that such a system could operate GUI ... automate a test without having benefit of your system. ...
    (comp.software.testing)
  • Re: library project
    ... Where does the Microsoft documentation say "The interface is immutable ... It is, by defnition, an error to change an ActiveX component ... a dll supplier ... languages the labels (static controls) and input (edit controls, ...
    (microsoft.public.vc.mfc)
  • Re: Powerpoint ActiveX errors (CHIRAG, can you help with this?)
    ... I recall reading that the controls for PPT/VBA are different (different interface? ... bool QueryInterface(string InterfaceName); ... public void AddRef() ...
    (microsoft.public.powerpoint)
  • Re: append simultaneously to multiple tables from form
    ... It appears you are helping me with two seperate posts on different problems. ... The interface, as you can imagine, is a nightmare because of expectations ... controls, mostly txtboxes, to take the data from. ... directions. ...
    (microsoft.public.access.forms)

Quantcast