polymorphism at the assembly load time

  • Thread starter Thread starter Boni
  • Start date Start date
B

Boni

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();

}
 
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 said:

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;
}
 
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
 
Back
Top