Type.TypeOf doesn't work ?

L

lothar.behrens

Hi,

I have some code, where I am using a variable for a given interface.
One step later, using Remoting, I need Type.TypeOf("...")

The following code returns Nothing, but the type above could be
declared for a variable.

Dim appMgr As MyInterfaces.IFoo

Dim myType As System.Type = Type.GetType("MyInterfaces.IFoo")

' myType is Nothing !!

Dim prx As MarshalByRefObject = Activator.GetObject(myType,
completeurl)

Any ideas ?

Thanks, Lothar
 
T

tommaso.gastaldi

hi lothar
Are you sure you need quotes in your gettype ?

-tom

(e-mail address removed) ha scritto:
 
P

Patrice

My guess would be that the name you are using is not fully qualified. If
this is defined in your application try
<PlaceYourAppRootNamespaceHere>.MyInterfaces.IFoo. If another DLL and you
imported the names, still use the full qualified name. If in doubt about the
fully qualified name, use the object browser to see the full qualified
name...
 
C

Cor Ligthert [MVP]

Lothar,

I don't believe it is the problem, but the information on MSDN on Gettype
for VBNet is lousy.

In VBNet it is normally easier to use Gettype(System.String)

Just as addition to Patrice,

Cor
 
L

lothar.behrens

Yes,

after reading about GetType, I have changed it to
GetType(Assembly.ClassTypeName).

This works for now, but I am in trouble with FileNotFoundException on
server side.
Maybe my app.config for the remoting configuration is not correct:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.runtime.remoting>
<application>
<channels>
<!-- Some chanels -->
</channels>
<service>
<wellknown type="Voil.VPMApplicationManager, VPMApplicationManager"
objectUri="VPMApplicationManager.rem" mode="Singleton" />
</service>
<RemoteServer>localhost</RemoteServer>
</application>
</system.runtime.remoting>

</configuration>

I'll do research on it, too :)

Lothar
 
L

lothar.behrens

I have it, and it works :)

<wellknown type="Voil.VPMApplicationManager, Voil">

Thanks, Lothar
 

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

Top