473,403 Members | 2,284 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

assembly loading problem

Hi

I'm currently working on a forms designer for a free .NET IDE
(SharpDevelop -> www.icsharpcode.net/OpenSource/SD).

problem:
I try to put 'custom' components (user controls from the current open
project) into the forms designer. The project must be compiled for
making this work. Now after recompile I need to update the user control
with the newly compiled version (maybe something has changed). And THAT
is the problem. I can't unload assemblies from the main app domain and I
assume that I can't use another appdomain for the forms designer
(because controls can't be exchanged between domain boundaries ... and I
need to show it somewhere). Therefore all I need is a solution to the
'update' problem.

Regards
Mike

Nov 13 '05 #1
3 4693
You'll need to have both your designer and your control in a separate
domain. Then when-ever you need to refresh the control, you'll need to tear
down that domain and create a new one.

--
--Grant
This posting is provided "AS IS" with no warranties, and confers no rights.
"Mike Krueger" <mi**@icsharpcode.net> wrote in message
news:Og**************@TK2MSFTNGP12.phx.gbl...
Hi

I'm currently working on a forms designer for a free .NET IDE
(SharpDevelop -> www.icsharpcode.net/OpenSource/SD).

problem:
I try to put 'custom' components (user controls from the current open
project) into the forms designer. The project must be compiled for
making this work. Now after recompile I need to update the user control
with the newly compiled version (maybe something has changed). And THAT
is the problem. I can't unload assemblies from the main app domain and I
assume that I can't use another appdomain for the forms designer
(because controls can't be exchanged between domain boundaries ... and I
need to show it somewhere). Therefore all I need is a solution to the
'update' problem.

Regards
Mike

Nov 13 '05 #2
Hi

Then I've two problems:

1. I can't share types between appdomains without having their
assemblies loaded in the appdomain as well.

2. I can't share windows.forms user controls over appdomain boundaries
(therefore I need at least the windows.forms designer in the main
appdomain ... because of problem 1 I couldn't test what happens if I try
to put a 'remote' control into the forms designer ... but I suppose that
this fails like remoting any other windows forms control :/)

My current solution for the problem is as follows:

Overwriting the AssemblyResolve event in the appdomain and >hard core<
loading the assemblies from the disc using a byte[] array (with this
trick I get around the locking problem).

But with this dirty hack I've another problem: a memory leak :/ but
currently I can't see an solution for getting around this problem. I've
dissassembled the TypeDesigner from Microsoft.VisualStudio.dll (which is
delivered with the framework, not with the IDE). And there its a
toolbox manager which does almost the same as I do as far as I can tell
except they don't load the assembly with the byte hack instead they're
copying it to a temporary location (Somewhere in the users appdata
folder) and there they load it with Assembly.LoadFile (LoadFile does
load assemblies twice, if needed LoadFrom doesn't do this it first looks
into the current appdomain).
Am I right that VS.NET has a memory leak ? And it allocates a few bytes
every time an assembly with an user control is recompiled ?

but nevertheless the AppDomain load/unload workaround would be nice if
it would work but I can't see to prevent the automatic assembly load, if
I transfer types and the unability to share controls between
appdomains in the same process is really a hard problem for C# users.
But maybe I'm completly wrong or I haven't seen another solution ?

Regards
Mike
You'll need to have both your designer and your control in a separate
domain. Then when-ever you need to refresh the control, you'll need to tear
down that domain and create a new one.


Nov 13 '05 #3
I don't know what the VS.NET designer does. You are correct as far as #1.
That's why you have to create a really good interface/class that will NOT
change, and can safely be loaded into both app domains, and can do the
appropriate communication between domains. The way I envision this
happening is that the shell and UI are all in your 'primary domain'. You
then start a secondary domain for the toolbox and designer. All code that
deals directly with control types has to go in the secondary domain. Then
whenever a control needs to be refreshed, you restart the secondary domain.

--
--Grant
This posting is provided "AS IS" with no warranties, and confers no rights.
"Mike Krueger" <mi**@icsharpcode.net> wrote in message
news:3F**************@icsharpcode.net...
Hi

Then I've two problems:

1. I can't share types between appdomains without having their
assemblies loaded in the appdomain as well.

Nov 13 '05 #4

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

Similar topics

0
by: Brent | last post by:
I maintain a Sql Server database application whose forms are compiled in a .dll and kept in a remote web folder. The main .exe looks to the web folder to see if this .dll exists. If so, then it...
4
by: Arnaud Debaene | last post by:
Hello group. I have an app which can load "plugins" assemblies that are described in the registry (each registry entry gives the full path to the plugin ..dll file). The plugins may be anywhere...
3
by: Atul Godbole | last post by:
Suppose an assembly "Main" is using class "A" from another Assembly "Dep" as follows : A a = new A(); a.MethodOne(); At what time is the call to MethodOne linked to the actual MSIL (method...
4
by: Mark | last post by:
I wan't to be able to deserialize a class from an assembly that is not in the application domain. To do that I must have the Type from the Assembly. How do you get a Type from an assembly that is...
1
by: Benjamin | last post by:
Hi, I'm currently writing a Web Services that interacts with a database. To allow me to use not just one database provider (for example, I could use MS Access, SQL Server or MySQL), the Web...
1
by: Brian | last post by:
I've looked through the previous posts on this one and have verified permissions and location of my Dlls, but I am still getting an exception when I try to Load an assembly. The directory where...
2
by: peter.drienovsky | last post by:
Hello, let me describe my problem: ENVIRONMENT: ..Net 2.0, MSVS 2005, c#, WinXP SYMPTOMS: If assembly 'AgentDesktop' IS NOT in the (loading) application folder,
2
by: Chen Zhuo | last post by:
Hi all experts, We are having a problem with the exact time when a C# dll gets loaded in managed C++. The scenario is like: In managed.cpp: #using MyCSharp.dll
2
by: millevlada | last post by:
Hi all. Here is description of my run-time assembly loading problem: I would like to have winService hosting .Net remoting objects. But, it should work in sort of pluginable way, so during...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
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...
0
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,...
0
isladogs
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...

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.