Re: Reflection messing up the type hierarchy



So far I am still researching the issue and I will update you with new
information ASAP.
BTW: what did you care in your scenario, if you want to to know if the
type
"stdole.StdPictureClass" is a subclass of typeof(object), we can just use
the method IsSubclassOf.

The issue is that we are writting a compiler for .NET and use reflection to
get the type hierarchy. When .NET changes the type hierarchy with a type
that is not public to any other assemblies this is really a problem. But
that's not it, not only the type is not public, but suddenly when you query
t.BaseType.IsPublic you get `true', and you have this new thing called
`IsVisible' in .NET 2.0 that says `false'. I'm wondering what does
`IsVisible' check internally to come up with this answer?

Then the problem we are having is that because reflection tells us type is
public we include it as the parent, but when our compiler tries to find that
parent in mscorlib it fails to find it since it is private.

We have a workaround for now, but this seems very fishy. We go up the type
hierarchy until we find a visible parent and set it to be the parent of that
class. Seems to work so far, but I really don't like it.

Regards,
Manu


.



Relevant Pages

  • Re: How to get a reference to parent object
    ... This requires that all of your objects inherit from a base object that has a Parent property, of course, or at least some mechanism for returning its parent. ... each class could have a Dataset property that defers to its parent's Dataset property if it does not itself have a Dataset property: ... I don't think anyone mentioned inheritance as a solution, and for good reason: inheritance and a child/parent relationship are completely different. ... In nested classes i can use reflection to ...
    (microsoft.public.dotnet.framework)
  • Re: web controls are NOT good use of encapsulation
    ... Now, using reflection like this, in a ASP.NET might not be the best solution; reflection isn't cheap, you might reconsider. ... Or, if the Org value is something that is global to the application, consider using the Global.asax; then the Control could do ... parent unless it explicitly states that it can't be a child of a class that doesn't implement this method. ... I don't know who my parent is... ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)
  • RE: Reflection not working anymore if creating the child window in a s
    ... I believe message reflection is not working because message from parent has ... notification of parent you manually reflect to the child window using ... > BEGIN_MESSAGE_MAP(CDirTreeCtrl, CTreeCtrl) ...
    (microsoft.public.vc.mfc)
  • Re: what is "reflect" ?
    ... TN062 talks about how reflection works. ... Simply it lets a control receive notification messages that are normally ... sent to the parent. ... If you want to create a listbox control that changes ...
    (microsoft.public.vc.mfc)
  • Re: How to get a reference to parent object
    ... You could use the same object instance at multiple places (i.e. you don't ... find the nearest parent node of a particular type, ... In nested classes i can use reflection ...
    (microsoft.public.dotnet.framework)

Loading