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 1762
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.co m
"José Joye" <jo*******@KILL THESPAMSbluewin .ch> wrote in message
news:eL******** ********@TK2MSF TNGP12.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.c om> wrote in
message news:%2******** ********@TK2MSF TNGP09.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.co m
"José Joye" <jo*******@KILL THESPAMSbluewin .ch> wrote in message news:eL******** ********@TK2MSF TNGP12.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.Exi t. If it is not.... I don't
know... you have choices...
Ultimately you can call AppDomain.Curre ntDomain.Unload .
HTH
B\rgds
100
"José Joye" <jo*******@KILL THESPAMSbluewin .ch> wrote in message
news:eL******** ********@TK2MSF TNGP12.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.co m
"José Joye" <jo*******@KILL THESPAMSbluewin .ch> wrote in message
news:us******** ******@tk2msftn gp13.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.c om> wrote
in message news:%2******** ********@TK2MSF TNGP09.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.co m
"José Joye" <jo*******@KILL THESPAMSbluewin .ch> wrote in message news:eL******** ********@TK2MSF TNGP12.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******** ******@tk2msftn gp13.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.Exi t. If it is not.... I don't know... you have choices... Ultimately you can call AppDomain.Curre ntDomain.Unload .
HTH B\rgds 100 "José Joye" <jo*******@KILL THESPAMSbluewin .ch> wrote in message news:eL******** ********@TK2MSF TNGP12.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*******@KILL THESPAMSbluewin .ch> wrote in message
news:%2******** **********@TK2M SFTNGP09.phx.gb l... 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******** ******@tk2msftn gp13.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.Exi t. If it is not.... I don't know... you have choices... Ultimately you can call AppDomain.Curre ntDomain.Unload .
HTH B\rgds 100 "José Joye" <jo*******@KILL THESPAMSbluewin .ch> wrote in message news:eL******** ********@TK2MSF TNGP12.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*******@KILL THESPAMSbluewin .ch> wrote in message
news:ua******** ********@tk2msf tngp13.phx.gbl. .. Got it. Need to call _set_error_mode (_OUT_TO_STDERR );
Thanks for your great help!
José "José Joye" <jo*******@KILL THESPAMSbluewin .ch> wrote in message news:%2******** **********@TK2M SFTNGP09.phx.gb l... 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******** ******@tk2msftn gp13.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.Exi t. If it is not.... I don't know... you have choices... Ultimately you can call AppDomain.Curre ntDomain.Unload .
HTH B\rgds 100 "José Joye" <jo*******@KILL THESPAMSbluewin .ch> wrote in message news:eL******** ********@TK2MSF TNGP12.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 thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Markus Breuer |
last post by:
I have a question about oracle commit and transactions. Following scenario:
Process A performs a single sql-INSERT into a table and commits the
transaction. Then he informs process B (ipc) to read the new date. So
process B starts "select ..." but does not get the previously inserted
row. The timespan between commit and select is very short.
(NOTE: two different sessions are used)
Questions:
1.) Does commit when returning from call...
|
by: José Joye |
last post by:
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é
|
by: MatthewRoberts |
last post by:
Howdy All,
I am having difficulty with two-way communication across AppDomains in
an attempt to dynamically script applications. Everything works as
expected, except when using ByRef parameters.
The below explanation is lengthy, but well worth the read. If you can
help me, I'd gladly share this code which has greatly helped my
development of extensible applications.
|
by: xixi |
last post by:
i have db2 udb v8.1 on windows 64 bit 2003 server, after db2 server
start , i found this in the db2diag.log, is this error?
2004-05-05-15.28.30.780000 Instance:DB2 Node:000
PID:1692(db2syscs.exe) TID:2860 Appid:AC10040A.GD5F.00FC56D8BEC5
base sys utilities sqledint Probe:30
Crash Recovery is needed.
2004-05-05-15.28.31.890000 Instance:DB2 Node:000
|
by: José Joye |
last post by:
I have a library written in C (I do not have the source) and having some
callbacks exported. It is currently not that stable and write to stdout and
stderr
:-((
The idea I have is to wrap it with a C# class and instanciate an instance of
this class within a new AppDomain.
Here are my question:
Am I correct to assume that I will be able to handle cases where the library
| |
by: Wal Turner |
last post by:
Hi there. There are various snippets on forums regarding issues with
AppDomain.Unload and how it just doesnt work.
Fortunately, I got it working with the base case, after much fiddling.
Consider this 5 line program:
AppDomain domain = AppDomain.CreateDomain("MyDomain");
domain.CreateInstance("TempDLL", "TempDLL.Class1");
MessageBox.Show("try deleting file now"); //cant delete file
AppDomain.Unload(domain);
|
by: pradeep_TP |
last post by:
Hi all,
I am using IIS 5.0 and this question is regarding working of ASP.net worker
process. I have only one web application right now on my web server. This
means that only one AppDomain will be created inside a single worker process.
NOw for example, due to some reason, my web application generated a stack
overflow error and crashed my appdoman (this happend in real case). In this
case as far as my knowledge goes, only appdomain...
|
by: ray |
last post by:
I have a client that doesn't want Access to automatically repair into a
backup file if it crashes (and it crashes only on very rare occasions).
My (sketchy) understanding is that this is a Windows function that
can't be stopped by using runtime switches, advanced options or other
hi-falutin' database properties.
Ami I correct that the automatic repair has nothing to do with Access
itself? Is there another way to stop it happening?
|
by: José Joye |
last post by:
I'm currently trying to load an instance of a given class within a secondary
appDomain and access it from within my main AppDomain.
Everything is fine and working if the class in the second AppDomain catches
any potential exception.
However, if I throw an error within a method that is implemented in the
object running in the 2nd AppDomain, this really gets bad!!!
I have tried to register to several events:
- AppDomain.UnhandledException...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |