473,800 Members | 2,640 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Default AppDomain

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.

-is there a way to get the Default AppDomain from the Current
AppDomain?
-has anybody found a way round this "GCHandle.. ." error ?

Thanks in advance

Jul 25 '07 #1
2 3474
This isn't an error, you are simply doing something that you can not do.
You are not allowed to pass GCHandle instances across app domains, and that
is exactly what you are trying to do.

What exactly are you trying to do here? Why are you passing a GCHandle
across app domains?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"siger99" <rm******@free. frwrote in message
news:11******** *************@r 34g2000hsd.goog legroups.com...
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.

-is there a way to get the Default AppDomain from the Current
AppDomain?
-has anybody found a way round this "GCHandle.. ." error ?

Thanks in advance

Jul 25 '07 #2
Hi,

Sorry for the late reply.

I am in a user-defined AppDomain (because I want to be able to unload
the assembly when I am done with it), and from this AppDomain, I call
the
3rd party assembly which expects the defalut AppDomain, hence the
crash.

So I have to figure out how to launch this 3rd party from the default
AppDomain to make it work.

Any idea?

Thanks again

Aug 2 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1374
by: Sean Hederman | last post by:
I've got a couple of things I'm not sure in my mind about as far as the options to CorBindToRuntimeEx go: 1. Is the default option for Windows Forms is STARTUP_LOADER_OPTIMIZATION_MULTI_DOMAIN_HOST? 2. If I start the default domain using STARTUP_LOADER_OPTIMIZATION_MULTI_DOMAIN_HOST, create a child AppDomain using LoaderOptimization.MultiDomain, and then load a non-strong named assembly into the Child Domain, does it get loaded...
2
4825
by: Martin Lapierre | last post by:
How can I remove the default exception handler handler? When adding a custom handler, I can't get rid of the VS.NET unhandled exception dialog. Ex: AppDomain currentDomain = AppDomain.CurrentDomain; currentDomain.UnhandledException += new UnhandledExceptionEventHandler(MyHandler); MyHandler gets called AFTER the default VS.NET unhandled exception handler
8
3517
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...
0
984
by: Daylor | last post by:
hi. how can i set the AppDomain.BaseDirectory to the default appdomain ? (i dont want /need to create new appdomain )
4
3896
by: Andy | last post by:
Hi, I was wondering if it was possible to get the Entry assembly for the default application domain (and how to determine what the default app domain is..). I'd like to get to it for logging purposes, and it would be nice it the object can discover that one its own, instead of trusting that a string it was passed is actually the name of the application.
2
3602
by: JohnH | last post by:
Hi, Does anyone know why the DomainUnload is not raised for the default AppDomain. I'm trying to get some shutdown code in a dynamically loaded assembly called before the application shuts down. I tried adding a handler for the DomainUnload event to the AppDomain.CurrentDomain, but this does not get raised because it is the
2
2319
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...
2
2050
by: Jeff | last post by:
Hi I'm trying to achieve a scenario where I have c# files that are compiled dynamically, the assemblies are then loaded in a different AppDomain, I call a simple method from the object, and then unload the AppDomain to release the lock on the assemly files (so to I can compile the code again if it has been modified). However, I've encountered a problem, whereby the assembly is also loaded in the default AppDomain! I have a few classes...
4
5339
by: illegal.prime | last post by:
Hi all, I'm getting unexpected results when trying to preload assemblies into an AppDomain I'm creating. Upon creation of the AppDomain - I attach an AssemblyResolve to both my current AppDomain and the new AppDomain I create. I copy all the assemblies/dlls into a new directory and then try loading them all into the new AppDomain using the following: private void LoadAssembliesFromDirectory(AppDomain appDomain, string directory)
0
9690
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10501
Oralloy
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...
0
10273
jinu1996
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...
1
10250
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10032
tracyyun
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...
0
9085
agi2029
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...
0
5603
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4149
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
3
2944
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.