Home All Groups Group Topic Archive Search About

Type.TypeOf doesn't work ?

Author
21 Jul 2006 8:03 AM
lothar.behrens@lollisoft.de
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

Author
21 Jul 2006 8:50 AM
tommaso.gastaldi
hi  lothar
Are you sure you need quotes in your gettype ?

-tom

lothar.behr***@lollisoft.de ha scritto:

Show quoteHide quote
> 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
Author
21 Jul 2006 9:18 AM
lothar.behrens@lollisoft.de
The required parameter is a string. Yes.

Lothar

tommaso.gasta***@uniroma1.it wrote:
Show quoteHide quote
> hi  lothar
> Are you sure you need quotes in your gettype ?
>
> -tom
>
> lothar.behr***@lollisoft.de ha scritto:
>
> > 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
Author
21 Jul 2006 9:54 AM
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...

--
Patrice

<lothar.behr***@lollisoft.de> a écrit dans le message de news:
1153473514.682476.129***@m73g2000cwd.googlegroups.com...
Show quoteHide quote
> The required parameter is a string. Yes.
>
> Lothar
>
> tommaso.gasta***@uniroma1.it wrote:
>> hi  lothar
>> Are you sure you need quotes in your gettype ?
>>
>> -tom
>>
>> lothar.behr***@lollisoft.de ha scritto:
>>
>> > 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
>
Author
21 Jul 2006 10:01 AM
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

<lothar.behr***@lollisoft.de> schreef in bericht
Show quoteHide quote
news:1153473514.682476.129610@m73g2000cwd.googlegroups.com...
> The required parameter is a string. Yes.
>
> Lothar
>
> tommaso.gasta***@uniroma1.it wrote:
>> hi  lothar
>> Are you sure you need quotes in your gettype ?
>>
>> -tom
>>
>> lothar.behr***@lollisoft.de ha scritto:
>>
>> > 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
>
Author
21 Jul 2006 10:11 AM
lothar.behrens@lollisoft.de
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

Cor Ligthert [MVP] wrote:
Show quoteHide quote
> 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
>
> <lothar.behr***@lollisoft.de> schreef in bericht
> news:1153473514.682476.129610@m73g2000cwd.googlegroups.com...
> > The required parameter is a string. Yes.
> >
> > Lothar
> >
> > tommaso.gasta***@uniroma1.it wrote:
> >> hi  lothar
> >> Are you sure you need quotes in your gettype ?
> >>
> >> -tom
> >>
> >> lothar.behr***@lollisoft.de ha scritto:
> >>
> >> > 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
> >
Author
21 Jul 2006 10:45 AM
lothar.behrens@lollisoft.de
I have it, and it works :-)

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

Thanks, Lothar

lothar.behr***@lollisoft.de wrote:
Show quoteHide quote
> 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
>
> Cor Ligthert [MVP] wrote:
> > 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
> >
> > <lothar.behr***@lollisoft.de> schreef in bericht
> > news:1153473514.682476.129610@m73g2000cwd.googlegroups.com...
> > > The required parameter is a string. Yes.
> > >
> > > Lothar
> > >
> > > tommaso.gasta***@uniroma1.it wrote:
> > >> hi  lothar
> > >> Are you sure you need quotes in your gettype ?
> > >>
> > >> -tom
> > >>
> > >> lothar.behr***@lollisoft.de ha scritto:
> > >>
> > >> > 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
> > >