polymorphism at the assembly load time

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

}
 
V

Vladimir Nesterovsky

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;
}
 
B

Boni

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top