Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / June 2005

Tip: Looking for answers? Try searching our database.

Threads created in unmanaged code always use the default app domai

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Paul Kenny - 08 Jun 2005 13:46 GMT
Hi,
I have developed an application that uses mixed C++ to integrate managed
.NET applications with an unmanaged C++ application whose behaviour I cannot
change.

The unmanaged C++ application uses the Win32 API's CreateThread fn to create
a thread that listens for requests. These requests then call into the mixed
C++ code. This all works fine when the application lives in the same app
domain.

However, in an environment such as IIS where the application lives in its
own app domain there is a problem because the thread that is being created in
the unmanaged code is using the default app domain and so cannot use the
objects created in the application's app domain. Is there anyway to get these
threads to use the applications app domain rather than the default app domain?

In my opinion this behaviour is a bug, I thought that the whole idea of an
app domain was to create a sandbox where by the main application (in this
case IIS) could run numerous applications without having to worry about their
behaviour. Yet using this method I have a thread running in the default app
domain which I assume would have the capability to bring down IIS.
 Cheers,
   Paul

Signature

Paul Kenny
Senior Software Engineer
IONA Technologies Plc.

Ronald Laeremans [MSFT] - 09 Jun 2005 23:06 GMT
> Hi,
> I have developed an application that uses mixed C++ to integrate managed
[quoted text clipped - 19 lines]
>   Cheers,
>     Paul

Create the thread on the managed side.

Ronald Laeremans'
Visual C++ team
Paul Kenny - 10 Jun 2005 12:01 GMT
Hi Ronald,
As I said in my original post I am integrating with a legacy unmanaged C++
application that I have no control of so it is not possible for me to create
the thread on the managed side. Is this the only way to work around this
issue?
By the way is there a bug number or something associated with this? Is it
considered a bug?? Is it likely to be fixed?
 Cheers,
   Paul

Signature

Paul Kenny
Senior Software Engineer
IONA Technologies Plc.

> > Hi,
> > I have developed an application that uses mixed C++ to integrate managed
[quoted text clipped - 24 lines]
> Ronald Laeremans'
> Visual C++ team
Ronald Laeremans [MSFT] - 14 Jun 2005 00:09 GMT
> Hi Ronald,
> As I said in my original post I am integrating with a legacy unmanaged C++
[quoted text clipped - 5 lines]
>   Cheers,
>     Paul

You can also use the .NET hosting APIs to get significantly more fine
grained control from the native side. You can take a look here for the
2.0 version of the hosting API:
http://winfx.msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_fxunma
nref/html/703b8381-43db-4a4d-9faa-cca39302d922.asp


Ronald

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.