Is this a bug in .NET? are we really on the cutting edge of technology
here????
Here's what he says:
I've got a plugin architecture system that calls LoadFrom to load the .dlls
in a specific folder and it works fine and dandy, imports everything, my
code
can create objects from types found in the loaded .dlls
HOWEVER, One issue i've not been able to solve is that, in some of the
classes, I've got custom Type Editors that do not function when I try to
edit
them via a PropertyGrid that is on my application's main form.
Whenever I create object from one of the plugged in .dlls and set it to the
property grid's selected object, trying to edit it does not produce the
correct type editor. This is especially the case with my custom collection
classes. Since most of them are inherited from ArrayList, I constantly get
the Object editor form.
Now here's the really wicked twist. If the plugins are set to references in
my project in vs.net, The correct editors will appear just fine.
I did some debugging by getting a type for one of my collections that uses a
custom editor, and wrote all the attributes from GetCustomAttributes method
and the System.ComponentModel.EditorAttribute was still a recognized
attribute on the class, eliminating my thought that perhaps the attribute
was
being lost during the LoadFrom.
I am totally baffled.
"Ron M. Newman" <co**********@confideltial.comwrote in message
news:%2***************@TK2MSFTNGP03.phx.gbl...
Hi,
I am using a property grid and I use custom type editors and type
converters. The properties are dynamic, not based on pre-compiled
properties/attributes so I'm using the "propertyBag" exmample
implementation. In order for it to work with custom editors and type
coverters you need to enter the fully qualified name of those classes into
a structure and then into a collection which is then used by an
ICustomTypeDescriptor to simulate dynamic properties.
That's really a property grid issue and i bring it as a background
explanation. It may be irrelevant to my question.
The symptoms I experience are
1) When the classes for the custom editor and typeConverter are
pre-compiled with the main application in which the property grid
resides -- everything works perfectly.
2) When the same classes are within a dynamically loaded assembly who's
Assembly object is a member of the main form of the main application - the
property grid ignores the input and reverts to its own standard
editor/typecoverter
3) Situation #2 + adding a reference to the assembly in the VS2005
project -- it WORKS prefectly.
This triggered my question. What's the difference between #1 and #3?
what's causing a mere Assembly.LoadFrom(...) not to function properly -
although I can generate types from it and they seem to work. when I submit
a string of a fully qualified class name from that assembly - it can't use
it to load the proper classes.
Where is my mistake?
Thanks
Ron
"Herfried K. Wagner [MVP]" <hi***************@gmx.atwrote in message
news:OD**************@TK2MSFTNGP06.phx.gbl...
>"Ron M. Newman" <co**********@confideltial.comschrieb:
>>I can load an assembly using the Assembly.Load(....)
However, I'd like dynamic loading of assemblies to be identical to
putting an assembly reference in your VS2005 project. and yes, I know
about the unloading problems. Let's say I don't care for the moment.
If I have an assemlbly file at "c:\\assembly.dll" - how do I load it at
runtime as if it were references in the project at build time?
Check out 'Assembly.Load*'.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>