Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / May 2005

Tip: Looking for answers? Try searching our database.

polymorphism at the assembly load time

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Boni - 11 May 2005 15:06 GMT
Dear All, Dear Tomas (My feeling is that you could like this for me very
complicated question).
I want at the run time resolve one of the added reference assemblies, but
the approach fails. fuslogvw shows, that
TypeAddedToReferencesButNotInTheRightPath  couldn't be found, even before
the message box pops up.
Did I missed somethig? I found
(http://www.codeproject.com/dotnet/loadpoly.asp), which seems to do quite
the same. Why CLR tries to load this type before it is used?
Please help me,
With best regards,
Boni
__gc public class test:

{

private:

Assembly * ResolveMe(Object *sender, System::ResolveEventArgs* args);

System::ResolveEventHandler* m_ResolveEventHandler;

Object __gc * pDynamic;

void test()

}

test::test()

{

MessageBox::Show("I am in costructor")

AppDomain::CurrentDomain->AssemblyResolve += new ResolveEventHandler(this,
ResolveMe);

pDynamic= new TypeAddedToReferencesButNotInTheRightPath

dynamic_cast<TypeAddedToReferencesButNotInTheRightPath*>(pDynamic)->Helloo();

}
Vladimir Nesterovsky - 11 May 2005 20:25 GMT
> Dear All, Dear Tomas (My feeling is that you could like this for me very
> complicated question).
[quoted text clipped - 34 lines]
>
> pDynamic= new TypeAddedToReferencesButNotInTheRightPath

dynamic_cast<TypeAddedToReferencesButNotInTheRightPath*>(pDynamic)->Helloo()
;

> }

I believe CLR resolves types at JIT time (at the first enter to the
test::test()). If you will separate first type access with installation of
AssemblyResolve event you possibly will succeed.

test::test()
{
   MessageBox::Show("I am in costructor")

   AppDomain::CurrentDomain->AssemblyResolve +=
       new ResolveEventHandler(this, ResolveMe);

   DoIt();
}

test::DoIt()
{
   TypeAddedToReferencesButNotInTheRightPath *dynamic =
       new TypeAddedToReferencesButNotInTheRightPath;
}

--
Vladimir Nesterovsky
e-mail: vladimir@nesterovsky-bros.com
home: http://www.nesterovsky-bros.com
Boni - 12 May 2005 08:06 GMT
Hi Vladimir,
you are right!!!!! Thaniks for the solution and for the link on your web
page to the comparision of source controls.
Best regards,
Boni
>> Dear All, Dear Tomas (My feeling is that you could like this for me very
>> complicated question).
[quoted text clipped - 65 lines]
> e-mail: vladimir@nesterovsky-bros.com
> home: http://www.nesterovsky-bros.com

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.