By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,877 Members | 1,047 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,877 IT Pros & Developers. It's quick & easy.

AppDomain Probing issue

P: n/a
Hello,

I created a small app which acts as a services manager. I basically drop a
DLL in a Services folder and set the frequency through the application for
how often do I want the code in the assembly to run (scheduler).

I created a seperate AppDomain here is the code:
....
AppDomainSetup ads = new AppDomainSetup();
string path =
Application.ExecutablePath.Replace(System.IO.Path. GetFileName(Application.Ex
ecutablePath),"");
ads.ApplicationBase = path + "Services";
ads.PrivateBinPathProbe = path + "Services";
ads.PrivateBinPath = path + "Services";
ads.DisallowBindingRedirects = true;
Tools.ShowInfo(path);
SvcBin = AppDomain.CreateDomain("ServiceAssemblies",null,ad s);

....

The above code was placed in the constructor. When I look through the
assemblies (GetAssemblies) to see a listing of all classes loaded, I don't
see the classes in the dll located in that services folder, which made me
think that it is not being probed. Anything I'm doing wrong?
--
Abdellah Elamiri
..net Developer
Efficacy through simplicity
Nov 16 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
The code you have by itself won't cause the assemblies in the Services
folder to be loaded -- it just creates a AppDomain. The assemblies will be
loaded the first time you create an instance of an object from one of them
(e.g., with AppDomain.CreateInstance()) or when you explicitly load them
(e.g., with AppDomain.Load()).

Ken

"A. Elamiri" <abdellahDOTelamiriATclintonDOTedutNOSPAM> wrote in message
news:OE**************@TK2MSFTNGP11.phx.gbl...
Hello,

I created a small app which acts as a services manager. I basically drop a
DLL in a Services folder and set the frequency through the application for
how often do I want the code in the assembly to run (scheduler).

I created a seperate AppDomain here is the code:
...
AppDomainSetup ads = new AppDomainSetup();
string path =
Application.ExecutablePath.Replace(System.IO.Path. GetFileName(Application.Ex ecutablePath),"");
ads.ApplicationBase = path + "Services";
ads.PrivateBinPathProbe = path + "Services";
ads.PrivateBinPath = path + "Services";
ads.DisallowBindingRedirects = true;
Tools.ShowInfo(path);
SvcBin = AppDomain.CreateDomain("ServiceAssemblies",null,ad s);

...

The above code was placed in the constructor. When I look through the
assemblies (GetAssemblies) to see a listing of all classes loaded, I don't
see the classes in the dll located in that services folder, which made me
think that it is not being probed. Anything I'm doing wrong?
--
Abdellah Elamiri
.net Developer
Efficacy through simplicity

Nov 16 '05 #2

P: n/a
In the code you have posted you have created the domain. but you haven't
loaded the assembly yet.

On the created domain you should call Load and pass the assembly which you
are trying to load as a param.

This time you don't have to pass any path information because that was
already supplied to the AppDomainSetup object.

regards,
Abhishek.

"A. Elamiri" <abdellahDOTelamiriATclintonDOTedutNOSPAM> wrote in message
news:OE**************@TK2MSFTNGP11.phx.gbl...
Hello,

I created a small app which acts as a services manager. I basically drop a
DLL in a Services folder and set the frequency through the application for
how often do I want the code in the assembly to run (scheduler).

I created a seperate AppDomain here is the code:
...
AppDomainSetup ads = new AppDomainSetup();
string path =
Application.ExecutablePath.Replace(System.IO.Path. GetFileName(Application.Ex ecutablePath),"");
ads.ApplicationBase = path + "Services";
ads.PrivateBinPathProbe = path + "Services";
ads.PrivateBinPath = path + "Services";
ads.DisallowBindingRedirects = true;
Tools.ShowInfo(path);
SvcBin = AppDomain.CreateDomain("ServiceAssemblies",null,ad s);

...

The above code was placed in the constructor. When I look through the
assemblies (GetAssemblies) to see a listing of all classes loaded, I don't
see the classes in the dll located in that services folder, which made me
think that it is not being probed. Anything I'm doing wrong?
--
Abdellah Elamiri
.net Developer
Efficacy through simplicity

Nov 16 '05 #3

P: n/a
Thanks for the replies, but now I'm getting a different error

Additional information: Insufficient state to deserialize the object. More
information is needed.

this occurs at this line
OwnerForm.SvcBin.Load("ClintonServices");

SvcBin is an AppDomain created by the OwnerForm, OwnerForm is simply the
parent windows form
--
Abdellah Elamiri
..net Developer
Efficacy through simplicity
"Abhishek Srivastava" <ab******@nospam.net> wrote in message
news:uK**************@TK2MSFTNGP12.phx.gbl...
In the code you have posted you have created the domain. but you haven't
loaded the assembly yet.

On the created domain you should call Load and pass the assembly which you
are trying to load as a param.

This time you don't have to pass any path information because that was
already supplied to the AppDomainSetup object.

regards,
Abhishek.

"A. Elamiri" <abdellahDOTelamiriATclintonDOTedutNOSPAM> wrote in message
news:OE**************@TK2MSFTNGP11.phx.gbl...
Hello,

I created a small app which acts as a services manager. I basically drop a DLL in a Services folder and set the frequency through the application for how often do I want the code in the assembly to run (scheduler).

I created a seperate AppDomain here is the code:
...
AppDomainSetup ads = new AppDomainSetup();
string path =

Application.ExecutablePath.Replace(System.IO.Path. GetFileName(Application.Ex
ecutablePath),"");
ads.ApplicationBase = path + "Services";
ads.PrivateBinPathProbe = path + "Services";
ads.PrivateBinPath = path + "Services";
ads.DisallowBindingRedirects = true;
Tools.ShowInfo(path);
SvcBin = AppDomain.CreateDomain("ServiceAssemblies",null,ad s);

...

The above code was placed in the constructor. When I look through the
assemblies (GetAssemblies) to see a listing of all classes loaded, I don't see the classes in the dll located in that services folder, which made me think that it is not being probed. Anything I'm doing wrong?
--
Abdellah Elamiri
.net Developer
Efficacy through simplicity


Nov 16 '05 #4

P: n/a
When you call AppDomain.Load() from a different AppDomain than the one in
which the assembly is loaded, you can often run into this problem. What's
happened is the assembly is indeed loaded into the other app domain. But, it
then attempts to return the assembly reference to the calling AppDomain.
That requires the calling AppDomain to load the assembly as well. But, since
the assembly isn't in the calling AppDomain's probing path (current
directory), the load fails.

Ken
"A. Elamiri" <abdellahDOTelamiriATclintonDOTedutNOSPAM> wrote in message
news:%2******************@TK2MSFTNGP12.phx.gbl...
Thanks for the replies, but now I'm getting a different error

Additional information: Insufficient state to deserialize the object. More information is needed.

this occurs at this line
OwnerForm.SvcBin.Load("ClintonServices");

SvcBin is an AppDomain created by the OwnerForm, OwnerForm is simply the
parent windows form
--
Abdellah Elamiri
.net Developer
Efficacy through simplicity
"Abhishek Srivastava" <ab******@nospam.net> wrote in message
news:uK**************@TK2MSFTNGP12.phx.gbl...
In the code you have posted you have created the domain. but you haven't
loaded the assembly yet.

On the created domain you should call Load and pass the assembly which you
are trying to load as a param.

This time you don't have to pass any path information because that was
already supplied to the AppDomainSetup object.

regards,
Abhishek.

"A. Elamiri" <abdellahDOTelamiriATclintonDOTedutNOSPAM> wrote in message
news:OE**************@TK2MSFTNGP11.phx.gbl...
Hello,

I created a small app which acts as a services manager. I basically drop
a DLL in a Services folder and set the frequency through the application for how often do I want the code in the assembly to run (scheduler).

I created a seperate AppDomain here is the code:
...
AppDomainSetup ads = new AppDomainSetup();
string path =

Application.ExecutablePath.Replace(System.IO.Path. GetFileName(Application.Ex ecutablePath),"");
ads.ApplicationBase = path + "Services";
ads.PrivateBinPathProbe = path + "Services";
ads.PrivateBinPath = path + "Services";
ads.DisallowBindingRedirects = true;
Tools.ShowInfo(path);
SvcBin = AppDomain.CreateDomain("ServiceAssemblies",null,ad s);

...

The above code was placed in the constructor. When I look through the
assemblies (GetAssemblies) to see a listing of all classes loaded, I don't see the classes in the dll located in that services folder, which made me think that it is not being probed. Anything I'm doing wrong?
--
Abdellah Elamiri
.net Developer
Efficacy through simplicity



Nov 16 '05 #5

P: n/a
That helped! thanks a lot everyone who answered

--
Abdellah Elamiri
..net Developer
Efficacy through simplicity
"Ken Kolda" <ke*******@elliemae-nospamplease.com> wrote in message
news:ui**************@tk2msftngp13.phx.gbl...
When you call AppDomain.Load() from a different AppDomain than the one in
which the assembly is loaded, you can often run into this problem. What's
happened is the assembly is indeed loaded into the other app domain. But, it then attempts to return the assembly reference to the calling AppDomain.
That requires the calling AppDomain to load the assembly as well. But, since the assembly isn't in the calling AppDomain's probing path (current
directory), the load fails.

Ken
"A. Elamiri" <abdellahDOTelamiriATclintonDOTedutNOSPAM> wrote in message
news:%2******************@TK2MSFTNGP12.phx.gbl...
Thanks for the replies, but now I'm getting a different error

Additional information: Insufficient state to deserialize the object.

More
information is needed.

this occurs at this line
OwnerForm.SvcBin.Load("ClintonServices");

SvcBin is an AppDomain created by the OwnerForm, OwnerForm is simply the
parent windows form
--
Abdellah Elamiri
.net Developer
Efficacy through simplicity
"Abhishek Srivastava" <ab******@nospam.net> wrote in message
news:uK**************@TK2MSFTNGP12.phx.gbl...
In the code you have posted you have created the domain. but you haven't loaded the assembly yet.

On the created domain you should call Load and pass the assembly which you are trying to load as a param.

This time you don't have to pass any path information because that was
already supplied to the AppDomainSetup object.

regards,
Abhishek.

"A. Elamiri" <abdellahDOTelamiriATclintonDOTedutNOSPAM> wrote in message news:OE**************@TK2MSFTNGP11.phx.gbl...
> Hello,
>
> I created a small app which acts as a services manager. I basically drop
a
> DLL in a Services folder and set the frequency through the application for
> how often do I want the code in the assembly to run (scheduler).
>
> I created a seperate AppDomain here is the code:
> ...
> AppDomainSetup ads = new AppDomainSetup();
> string path =
>

Application.ExecutablePath.Replace(System.IO.Path. GetFileName(Application.Ex > ecutablePath),"");
> ads.ApplicationBase = path + "Services";
> ads.PrivateBinPathProbe = path + "Services";
> ads.PrivateBinPath = path + "Services";
> ads.DisallowBindingRedirects = true;
> Tools.ShowInfo(path);
> SvcBin = AppDomain.CreateDomain("ServiceAssemblies",null,ad s);
>
> ...
>
> The above code was placed in the constructor. When I look through the > assemblies (GetAssemblies) to see a listing of all classes loaded, I

don't
> see the classes in the dll located in that services folder, which
made me
> think that it is not being probed. Anything I'm doing wrong?
> --
> Abdellah Elamiri
> .net Developer
> Efficacy through simplicity
>
>



Nov 16 '05 #6

P: n/a
Hi Ken,

just curious (never had to deal with this) - how the you load an
assembly in the new appdomain without loading it in the calling one?

Sunny

In article <ui**************@tk2msftngp13.phx.gbl>, ken.kolda@elliemae-
nospamplease.com says...
When you call AppDomain.Load() from a different AppDomain than the one in
which the assembly is loaded, you can often run into this problem. What's
happened is the assembly is indeed loaded into the other app domain. But, it
then attempts to return the assembly reference to the calling AppDomain.
That requires the calling AppDomain to load the assembly as well. But, since
the assembly isn't in the calling AppDomain's probing path (current
directory), the load fails.

Ken
"A. Elamiri" <abdellahDOTelamiriATclintonDOTedutNOSPAM> wrote in message
news:%2******************@TK2MSFTNGP12.phx.gbl...
Thanks for the replies, but now I'm getting a different error

Additional information: Insufficient state to deserialize the object.

More
information is needed.

this occurs at this line
OwnerForm.SvcBin.Load("ClintonServices");

SvcBin is an AppDomain created by the OwnerForm, OwnerForm is simply the
parent windows form
--
Abdellah Elamiri
.net Developer
Efficacy through simplicity
"Abhishek Srivastava" <ab******@nospam.net> wrote in message
news:uK**************@TK2MSFTNGP12.phx.gbl...
In the code you have posted you have created the domain. but you haven't
loaded the assembly yet.

On the created domain you should call Load and pass the assembly which you are trying to load as a param.

This time you don't have to pass any path information because that was
already supplied to the AppDomainSetup object.

regards,
Abhishek.

"A. Elamiri" <abdellahDOTelamiriATclintonDOTedutNOSPAM> wrote in message
news:OE**************@TK2MSFTNGP11.phx.gbl...
> Hello,
>
> I created a small app which acts as a services manager. I basically drop
a
> DLL in a Services folder and set the frequency through the application

for
> how often do I want the code in the assembly to run (scheduler).
>
> I created a seperate AppDomain here is the code:
> ...
> AppDomainSetup ads = new AppDomainSetup();
> string path =
>

Application.ExecutablePath.Replace(System.IO.Path. GetFileName(Application.Ex > ecutablePath),"");
> ads.ApplicationBase = path + "Services";
> ads.PrivateBinPathProbe = path + "Services";
> ads.PrivateBinPath = path + "Services";
> ads.DisallowBindingRedirects = true;
> Tools.ShowInfo(path);
> SvcBin = AppDomain.CreateDomain("ServiceAssemblies",null,ad s);
>
> ...
>
> The above code was placed in the constructor. When I look through the
> assemblies (GetAssemblies) to see a listing of all classes loaded, I

don't
> see the classes in the dll located in that services folder, which made

me
> think that it is not being probed. Anything I'm doing wrong?
> --
> Abdellah Elamiri
> .net Developer
> Efficacy through simplicity
>
>



Nov 16 '05 #7

P: n/a
I've done this using the AppDomain.DoCallback(). Make sure the delegate is
marshal-by-value and have the delegate that's invoked call
AppDomain.CurrentDomain.Load(). Of course, that means the new appdomain will
have to load the assembly that contains the definition of the class
containing the delegate, so hopefully that's acceptable.

Ken
"Sunny" <su***@newsgroups.nospam> wrote in message
news:e$**************@TK2MSFTNGP09.phx.gbl...
Hi Ken,

just curious (never had to deal with this) - how the you load an
assembly in the new appdomain without loading it in the calling one?

Sunny

In article <ui**************@tk2msftngp13.phx.gbl>, ken.kolda@elliemae-
nospamplease.com says...
When you call AppDomain.Load() from a different AppDomain than the one in
which the assembly is loaded, you can often run into this problem. What's happened is the assembly is indeed loaded into the other app domain. But, it then attempts to return the assembly reference to the calling AppDomain.
That requires the calling AppDomain to load the assembly as well. But, since the assembly isn't in the calling AppDomain's probing path (current
directory), the load fails.

Ken
"A. Elamiri" <abdellahDOTelamiriATclintonDOTedutNOSPAM> wrote in message
news:%2******************@TK2MSFTNGP12.phx.gbl...
Thanks for the replies, but now I'm getting a different error

Additional information: Insufficient state to deserialize the object.

More
information is needed.

this occurs at this line
OwnerForm.SvcBin.Load("ClintonServices");

SvcBin is an AppDomain created by the OwnerForm, OwnerForm is simply the parent windows form
--
Abdellah Elamiri
.net Developer
Efficacy through simplicity
"Abhishek Srivastava" <ab******@nospam.net> wrote in message
news:uK**************@TK2MSFTNGP12.phx.gbl...
> In the code you have posted you have created the domain. but you haven't > loaded the assembly yet.
>
> On the created domain you should call Load and pass the assembly which
you
> are trying to load as a param.
>
> This time you don't have to pass any path information because that
was > already supplied to the AppDomainSetup object.
>
> regards,
> Abhishek.
>
> "A. Elamiri" <abdellahDOTelamiriATclintonDOTedutNOSPAM> wrote in message > news:OE**************@TK2MSFTNGP11.phx.gbl...
> > Hello,
> >
> > I created a small app which acts as a services manager. I basically drop
a
> > DLL in a Services folder and set the frequency through the

application for
> > how often do I want the code in the assembly to run (scheduler).
> >
> > I created a seperate AppDomain here is the code:
> > ...
> > AppDomainSetup ads = new AppDomainSetup();
> > string path =
> >
>

Application.ExecutablePath.Replace(System.IO.Path. GetFileName(Application.Ex
> > ecutablePath),"");
> > ads.ApplicationBase = path + "Services";
> > ads.PrivateBinPathProbe = path + "Services";
> > ads.PrivateBinPath = path + "Services";
> > ads.DisallowBindingRedirects = true;
> > Tools.ShowInfo(path);
> > SvcBin = AppDomain.CreateDomain("ServiceAssemblies",null,ad s);
> >
> > ...
> >
> > The above code was placed in the constructor. When I look through the > > assemblies (GetAssemblies) to see a listing of all classes loaded, I don't
> > see the classes in the dll located in that services folder, which made me
> > think that it is not being probed. Anything I'm doing wrong?
> > --
> > Abdellah Elamiri
> > .net Developer
> > Efficacy through simplicity
> >
> >
>
>


Nov 16 '05 #8

P: n/a
Thanks

In article <OY**************@TK2MSFTNGP11.phx.gbl>, ken.kolda@elliemae-
nospamplease.com says...
I've done this using the AppDomain.DoCallback(). Make sure the delegate is
marshal-by-value and have the delegate that's invoked call
AppDomain.CurrentDomain.Load(). Of course, that means the new appdomain will
have to load the assembly that contains the definition of the class
containing the delegate, so hopefully that's acceptable.

Ken
"Sunny" <su***@newsgroups.nospam> wrote in message
news:e$**************@TK2MSFTNGP09.phx.gbl...
Hi Ken,

just curious (never had to deal with this) - how the you load an
assembly in the new appdomain without loading it in the calling one?

Sunny

In article <ui**************@tk2msftngp13.phx.gbl>, ken.kolda@elliemae-
nospamplease.com says...
When you call AppDomain.Load() from a different AppDomain than the one in which the assembly is loaded, you can often run into this problem. What's happened is the assembly is indeed loaded into the other app domain. But, it then attempts to return the assembly reference to the calling AppDomain.
That requires the calling AppDomain to load the assembly as well. But, since the assembly isn't in the calling AppDomain's probing path (current
directory), the load fails.

Ken
"A. Elamiri" <abdellahDOTelamiriATclintonDOTedutNOSPAM> wrote in message
news:%2******************@TK2MSFTNGP12.phx.gbl...
> Thanks for the replies, but now I'm getting a different error
>
> Additional information: Insufficient state to deserialize the object.
More
> information is needed.
>
> this occurs at this line
> OwnerForm.SvcBin.Load("ClintonServices");
>
> SvcBin is an AppDomain created by the OwnerForm, OwnerForm is simply the > parent windows form
>
>
> --
> Abdellah Elamiri
> .net Developer
> Efficacy through simplicity
> "Abhishek Srivastava" <ab******@nospam.net> wrote in message
> news:uK**************@TK2MSFTNGP12.phx.gbl...
> > In the code you have posted you have created the domain. but you haven't > > loaded the assembly yet.
> >
> > On the created domain you should call Load and pass the assembly which you
> > are trying to load as a param.
> >
> > This time you don't have to pass any path information because that was > > already supplied to the AppDomainSetup object.
> >
> > regards,
> > Abhishek.
> >
> > "A. Elamiri" <abdellahDOTelamiriATclintonDOTedutNOSPAM> wrote in message > > news:OE**************@TK2MSFTNGP11.phx.gbl...
> > > Hello,
> > >
> > > I created a small app which acts as a services manager. I basically drop
> a
> > > DLL in a Services folder and set the frequency through the application > for
> > > how often do I want the code in the assembly to run (scheduler).
> > >
> > > I created a seperate AppDomain here is the code:
> > > ...
> > > AppDomainSetup ads = new AppDomainSetup();
> > > string path =
> > >
> >
>
Application.ExecutablePath.Replace(System.IO.Path. GetFileName(Application.Ex > > > ecutablePath),"");
> > > ads.ApplicationBase = path + "Services";
> > > ads.PrivateBinPathProbe = path + "Services";
> > > ads.PrivateBinPath = path + "Services";
> > > ads.DisallowBindingRedirects = true;
> > > Tools.ShowInfo(path);
> > > SvcBin = AppDomain.CreateDomain("ServiceAssemblies",null,ad s);
> > >
> > > ...
> > >
> > > The above code was placed in the constructor. When I look through the > > > assemblies (GetAssemblies) to see a listing of all classes loaded, I > don't
> > > see the classes in the dll located in that services folder, which made > me
> > > think that it is not being probed. Anything I'm doing wrong?
> > > --
> > > Abdellah Elamiri
> > > .net Developer
> > > Efficacy through simplicity
> > >
> > >
> >
> >
>
>


Nov 16 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.