I have a windows service where I create another appdomains. In the newly
created AppDomain, I make use of a C library. If I issue an Abort(1) within
this library, it simply hard stop my main AppDomain!!!!!!!!!!!!How could I
prevent my main AppDomain to stop when the other stopped?Thanks a lot,José 7 2207
Jose,
Unfortunately, in C, the abort function will terminate the process that
it is running in. If it does this, then I don't think that there is a
workaround for it. You will have to run this separately in another process
and marshal any calls/values back to you.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"José Joye" <jo*******@KILLTHESPAMSbluewin.ch> wrote in message
news:eL****************@TK2MSFTNGP12.phx.gbl... I have a windows service where I create another appdomains. In the newly created AppDomain, I make use of a C library. If I issue an Abort(1)
within this library, it simply hard stop my main AppDomain!!!!!!!!!!!!How could I prevent my main AppDomain to stop when the other stopped?Thanks a lot,José
Harrrrg,
Let's say I make a modification to this legacy library and install a "signal
handler" that will send, through a delegate, information that an exception
occured.
Is there a way to unload the AppDomain where the C code is loaded without
having my main domain to miserably terminate?
José
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:%2****************@TK2MSFTNGP09.phx.gbl... Jose,
Unfortunately, in C, the abort function will terminate the process
that it is running in. If it does this, then I don't think that there is a workaround for it. You will have to run this separately in another
process and marshal any calls/values back to you.
Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard.caspershouse.com
"José Joye" <jo*******@KILLTHESPAMSbluewin.ch> wrote in message news:eL****************@TK2MSFTNGP12.phx.gbl... I have a windows service where I create another appdomains. In the
newly created AppDomain, I make use of a C library. If I issue an Abort(1) within this library, it simply hard stop my main AppDomain!!!!!!!!!!!!How could
I prevent my main AppDomain to stop when the other stopped?Thanks a
lot,José
Hi Jose,
*abort* terminates the whole process. So all application domains on it will
be terminated. What you can do is to install signal handler for SIGABRT
signal. Hopefully you can do it form managed code with P/Invloke.
So maybe you will install that handler form the same application domain that
you want to terminate.
If it is a GUI you can call Application.Exit. If it is not.... I don't
know... you have choices...
Ultimately you can call AppDomain.CurrentDomain.Unload.
HTH
B\rgds
100
"José Joye" <jo*******@KILLTHESPAMSbluewin.ch> wrote in message
news:eL****************@TK2MSFTNGP12.phx.gbl... I have a windows service where I create another appdomains. In the newly created AppDomain, I make use of a C library. If I issue an Abort(1)
within this library, it simply hard stop my main AppDomain!!!!!!!!!!!!How could I prevent my main AppDomain to stop when the other stopped?Thanks a lot,José
Jose,
This would work much better. If you have your C code changed so that it
issues an error code of some sort, instead of calling abort, that would be
optimal. Then, from the managed side, you can decide what to do when it
fails.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"José Joye" <jo*******@KILLTHESPAMSbluewin.ch> wrote in message
news:us**************@tk2msftngp13.phx.gbl... Harrrrg,
Let's say I make a modification to this legacy library and install a
"signal handler" that will send, through a delegate, information that an exception occured. Is there a way to unload the AppDomain where the C code is loaded without having my main domain to miserably terminate?
José
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote
in message news:%2****************@TK2MSFTNGP09.phx.gbl... Jose,
Unfortunately, in C, the abort function will terminate the process that it is running in. If it does this, then I don't think that there is a workaround for it. You will have to run this separately in another process and marshal any calls/values back to you.
Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard.caspershouse.com
"José Joye" <jo*******@KILLTHESPAMSbluewin.ch> wrote in message news:eL****************@TK2MSFTNGP12.phx.gbl... I have a windows service where I create another appdomains. In the newly created AppDomain, I make use of a C library. If I issue an Abort(1) within this library, it simply hard stop my main AppDomain!!!!!!!!!!!!How
could I prevent my main AppDomain to stop when the other stopped?Thanks a lot,José
I did this directly in the C Library (just as a quick test).
This sounds now much better. I'm able to unload the appDomain directly
within the faulty AppDomain.
I'm also able to reload it again from the main AppDomain.
HOWEVER!!!!
I always get a popup message when the dll containing the C code terminates:
Visual C++ Runtime Library
Runtime Error!
This application has requested the Runtime to terminate it in an unusual
way.
And the Service locks until I press OK...
Is there a way to prevent such a message to be thrown?
======= C code snippet =========
// JOJ
signal(SIGABRT, inthandler);
signal(SIGFPE, inthandler);
signal(SIGILL, inthandler);
signal(SIGSEGV, inthandler);
// JOJ
....
....
void
inthandler (int arg)
{
// JOJ: Write info to local memory log and call our delegate to inform
about the problem
......
(*ExitRamitPtr)(9999);
return;
}
"100" <10*@100.com> wrote in message
news:e8**************@tk2msftngp13.phx.gbl... Hi Jose, *abort* terminates the whole process. So all application domains on it
will be terminated. What you can do is to install signal handler for SIGABRT signal. Hopefully you can do it form managed code with P/Invloke.
So maybe you will install that handler form the same application domain
that you want to terminate. If it is a GUI you can call Application.Exit. If it is not.... I don't know... you have choices... Ultimately you can call AppDomain.CurrentDomain.Unload.
HTH B\rgds 100 "José Joye" <jo*******@KILLTHESPAMSbluewin.ch> wrote in message news:eL****************@TK2MSFTNGP12.phx.gbl... I have a windows service where I create another appdomains. In the
newly created AppDomain, I make use of a C library. If I issue an Abort(1)
within this library, it simply hard stop my main AppDomain!!!!!!!!!!!!How could
I prevent my main AppDomain to stop when the other stopped?Thanks a
lot,José
Got it. Need to call
_set_error_mode(_OUT_TO_STDERR);
Thanks for your great help!
José
"José Joye" <jo*******@KILLTHESPAMSbluewin.ch> wrote in message
news:%2******************@TK2MSFTNGP09.phx.gbl... I did this directly in the C Library (just as a quick test).
This sounds now much better. I'm able to unload the appDomain directly within the faulty AppDomain. I'm also able to reload it again from the main AppDomain.
HOWEVER!!!! I always get a popup message when the dll containing the C code
terminates: >>>> Visual C++ Runtime Library Runtime Error! This application has requested the Runtime to terminate it in an
unusual way. >>>> And the Service locks until I press OK...
Is there a way to prevent such a message to be thrown?
======= C code snippet ========= // JOJ signal(SIGABRT, inthandler); signal(SIGFPE, inthandler); signal(SIGILL, inthandler); signal(SIGSEGV, inthandler); // JOJ
... ... void inthandler (int arg) { // JOJ: Write info to local memory log and call our delegate to inform about the problem ...... (*ExitRamitPtr)(9999); return; }
"100" <10*@100.com> wrote in message news:e8**************@tk2msftngp13.phx.gbl... Hi Jose, *abort* terminates the whole process. So all application domains on it will be terminated. What you can do is to install signal handler for SIGABRT signal. Hopefully you can do it form managed code with P/Invloke.
So maybe you will install that handler form the same application domain that you want to terminate. If it is a GUI you can call Application.Exit. If it is not.... I don't know... you have choices... Ultimately you can call AppDomain.CurrentDomain.Unload.
HTH B\rgds 100 "José Joye" <jo*******@KILLTHESPAMSbluewin.ch> wrote in message news:eL****************@TK2MSFTNGP12.phx.gbl... I have a windows service where I create another appdomains. In the newly created AppDomain, I make use of a C library. If I issue an Abort(1) within this library, it simply hard stop my main AppDomain!!!!!!!!!!!!How
could I prevent my main AppDomain to stop when the other stopped?Thanks a lot,José
Great! :-)
B\rgds
100
"José Joye" <jo*******@KILLTHESPAMSbluewin.ch> wrote in message
news:ua****************@tk2msftngp13.phx.gbl... Got it. Need to call _set_error_mode(_OUT_TO_STDERR);
Thanks for your great help!
José "José Joye" <jo*******@KILLTHESPAMSbluewin.ch> wrote in message news:%2******************@TK2MSFTNGP09.phx.gbl... I did this directly in the C Library (just as a quick test).
This sounds now much better. I'm able to unload the appDomain directly within the faulty AppDomain. I'm also able to reload it again from the main AppDomain.
HOWEVER!!!! I always get a popup message when the dll containing the C code terminates: >>>> Visual C++ Runtime Library Runtime Error! This application has requested the Runtime to terminate it in an
unusual way. >>>>
And the Service locks until I press OK...
Is there a way to prevent such a message to be thrown?
======= C code snippet ========= // JOJ signal(SIGABRT, inthandler); signal(SIGFPE, inthandler); signal(SIGILL, inthandler); signal(SIGSEGV, inthandler); // JOJ
... ... void inthandler (int arg) { // JOJ: Write info to local memory log and call our delegate to inform about the problem ...... (*ExitRamitPtr)(9999); return; }
"100" <10*@100.com> wrote in message news:e8**************@tk2msftngp13.phx.gbl... Hi Jose, *abort* terminates the whole process. So all application domains on it will be terminated. What you can do is to install signal handler for
SIGABRT signal. Hopefully you can do it form managed code with P/Invloke.
So maybe you will install that handler form the same application
domain that you want to terminate. If it is a GUI you can call Application.Exit. If it is not.... I don't know... you have choices... Ultimately you can call AppDomain.CurrentDomain.Unload.
HTH B\rgds 100 "José Joye" <jo*******@KILLTHESPAMSbluewin.ch> wrote in message news:eL****************@TK2MSFTNGP12.phx.gbl... > I have a windows service where I create another appdomains. In the newly > created AppDomain, I make use of a C library. If I issue an Abort(1) within > this library, it simply hard stop my main AppDomain!!!!!!!!!!!!How could I > prevent my main AppDomain to stop when the other stopped?Thanks a lot,José > >
This discussion thread is closed Replies have been disabled for this discussion. Similar topics
11 posts
views
Thread by Markus Breuer |
last post: by
|
1 post
views
Thread by MatthewRoberts |
last post: by
|
10 posts
views
Thread by xixi |
last post: by
|
2 posts
views
Thread by José Joye |
last post: by
|
7 posts
views
Thread by José Joye |
last post: by
|
6 posts
views
Thread by Wal Turner |
last post: by
|
6 posts
views
Thread by pradeep_TP |
last post: by
|
2 posts
views
Thread by ray |
last post: by
|
1 post
views
Thread by José Joye |
last post: by
| | | | | | | | | | |