Hello,
We have a situation where a managed C++ assembly links with native C++ dll.
There is a callback mechanism which calls back into the managed code
asynchronously. Since native classes cannot hold onto a managed reference,
we need to have a managed static member which we access during the callback
and then get into the managed code.
This works great in a console or WinForm app. But in ASP.NET it doesn't. The
reason is that each web site is loaded into its own AppDomain.
After some debugging we found out that the managed static is set on
AppDomain 2, but the callback happens on AppDomain 1 (the default domain).
When the callback code tries to access the managed static - it is undefined.
We found a way to do a call into a different AppDomain, but only when you
already have a reference to that AppDomain and we don't - there doesn't seem
to be a way to enumerate AppDomains in a process.
Has anybody else run into this?
Is there a way to have ASP.NET (or the CLR) to not load the native code into
the neutral domain, instead load it into each AppDomain? 2 1825
"Dave Burns" <db********@aol .comwrote in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
Hello,
We have a situation where a managed C++ assembly links with native C++
dll.
There is a callback mechanism which calls back into the managed code
asynchronously. Since native classes cannot hold onto a managed reference,
Why not? There's gcroot and HandleRef and so forth to help with that.
we need to have a managed static member which we access during the
callback
and then get into the managed code.
This works great in a console or WinForm app. But in ASP.NET it doesn't.
The
reason is that each web site is loaded into its own AppDomain.
After some debugging we found out that the managed static is set on
AppDomain 2, but the callback happens on AppDomain 1 (the default domain).
When the callback code tries to access the managed static - it is
undefined.
We found a way to do a call into a different AppDomain, but only when you
already have a reference to that AppDomain and we don't - there doesn't
seem
to be a way to enumerate AppDomains in a process.
Has anybody else run into this?
Is there a way to have ASP.NET (or the CLR) to not load the native code
into
the neutral domain, instead load it into each AppDomain?
Thanks,
I tried gcroot as well, but same result - still can't call across
AppDomains.
dave
"Ben Voigt" <rb*@nospam.nos pamwrote in message
news:uP******** ******@TK2MSFTN GP02.phx.gbl...
>
"Dave Burns" <db********@aol .comwrote in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
>Hello,
We have a situation where a managed C++ assembly links with native C++ dll. There is a callback mechanism which calls back into the managed code asynchronously . Since native classes cannot hold onto a managed reference,
Why not? There's gcroot and HandleRef and so forth to help with that.
>we need to have a managed static member which we access during the callback and then get into the managed code.
This works great in a console or WinForm app. But in ASP.NET it doesn't. The reason is that each web site is loaded into its own AppDomain.
After some debugging we found out that the managed static is set on AppDomain 2, but the callback happens on AppDomain 1 (the default domain). When the callback code tries to access the managed static - it is undefined.
We found a way to do a call into a different AppDomain, but only when you already have a reference to that AppDomain and we don't - there doesn't seem to be a way to enumerate AppDomains in a process.
Has anybody else run into this?
Is there a way to have ASP.NET (or the CLR) to not load the native code into the neutral domain, instead load it into each AppDomain?
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Daylor |
last post by:
in win32 process , when u create new process,u have new main thread.
i know,appDomain r logical procces,that exists in 1 win32 process.
the q:
is there way to create second appDomain (the first 1 is the defualt
appDomain) with his new ("main") thread ?
if not ,what is the easy and clear way to create new thread on the new
appDomain ?
|
by: Chris |
last post by:
Hi
I have a scenario where I've created another AppDomain to dynamically load a DLL(s) into. In this newly loaded DLL I want to call a static method on a class. The problem arise is that I have the same class/static method definition statictly linked to my EXE and when I call InvokeMember(...), even though I got the Type from the new AppDomain, it calls the static method that I am staticly linked to and not the static method in the dynamicly...
|
by: Bryan |
last post by:
I have a multi-threaded C# console application that uses WMI
(System.Management namespace) to make RPC calls to several servers (600+ )
and returns ScheduledJobs. The section of my code that performs the query
is contained in a delegate function that I execute via a second thread. On 1
or 2 of the 600+ servers the query hangs. I've tried to use Thread.Join()
coupled with a Thread.Abort() but this does not kill the thread.
Based on...
|
by: Bern McCarty |
last post by:
Is it at all possible to leverage mixed-mode assemblies from AppDomains
other than the default AppDomain? Is there any means at all of doing this?
Mixed-mode is incredibly convenient, but if I cannot load/unload/reload
extensions into my large and slow-to-load application during development
without restarting the process then the disadvantages may outweigh the
advantages.
I've got a mixed-mode program in which I create a new AppDomain...
|
by: Tim Menninger |
last post by:
Just started working on this and have not found any real good resources out
there. We have a lot of native C++ Dll code that we use for our app. We want
to share the code so that C# ASP.net code can use the same business logic as
our C++ client. Here are some questions:
1) Is there a way to call into native C++ classes directly? Meaning we do
not have C API. I believe we could use a C API using the in C#.
2) If can't do #1, do we need...
| |
by: H.B. |
last post by:
Hi,
I need to make a function that can display data on my Managed C++ app and be
called by an unmanaged C++ DLL. Something like :
void Form1::Form1_Load(System::Object * sender, System::EventArgs * e)
{
MyDLLInit(MyAppDisplayFunction);
}
|
by: RalphTheExpert |
last post by:
This thread is a continuation of a thread with the Subject "Unhandled
exception - Different under debugger and non-debugger".
(http://www.dotnetnewsgroups.com/newsgroupthread.asp?ID=186902)
Oleg and Carl:
Carl wrote: "I would think the only fully sanitary, guaranteed to work
way would be to either terminate the program from inside the handler, or
|
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: Dave Burns |
last post by:
Hello,
We have a situation where a managed C++ assembly links with native C++ dll.
There is a callback mechanism which calls back into the managed code
asynchronously. Since native classes cannot hold onto a managed reference,
we need to have a managed static member which we access during the callback
and then get into the managed code.
This works great in a console or WinForm app. But in ASP.NET it doesn't. The
reason is that each...
|
by: siger99 |
last post by:
Hi,
I try to use a 3rd party assembly ( basically a layer of managed C++
around a native C++ lib).
Unfortunately, it was developped for NET 1.1 and knows only the
default AppDomain.
When I try to call it from another AppDomain, I get the "Cannot pass a
GCHandle across AppDomains" error.
|
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: 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: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| | |