473,513 Members | 2,563 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Failures with dynamic in-memory assembly generation

Hi!

I'm trying to create in-memory assemblies from source using C# 2.0 from
Visual Studio 2005 Beta 2. The generated assembly should have the same
name as an assembly that may already exist on disk in the same directory
the assembly-generating executable is running from.

The code I'm using is as follows:
string Code = "public class PolicyAccess ";
Code += "{ ";
Code += "public void GetPolicy (out string
preferredConnectionType) ";
[...snip...]
CompilerParameters Parameters = new CompilerParameters ();
Parameters.GenerateExecutable = false;
Parameters.GenerateInMemory = true;
Parameters.OutputAssembly = "Dummy.dll";
CodeDomProvider Compiler = CodeDomProvider.CreateProvider
("csharp");
CompilerResults CompResult = Compiler.CompileAssemblyFromSource
(Parameters, new string[] { Code });
Assembly TheAssembly = CompResult.CompiledAssembly;

When I execute this and want to access the CompResult, I either get a
FileNotFoundException in case there is no DLL with the
Parameters.OutputAssembly
name in the directory. Or I get a BadImageFormatException if I just put some
other
file (image, text, etc.) with the required name in the directory. Or, if
some other
assembly with the OutputAssembly name is in the directory, this assembly
gets
loaded, with the types contained in it but not with the types in the Code
string!
In any case I never get to see the type "PolicyAccess" with the method
"GetPolicy".

What is going wrong here??? I was assuming that if one creates an assembly
with
"GenerateInMemory = true" then there would not be any files involved at all.
Is there some "force assembly generation to file" option or something like
that?

Thanks,
Andreas

Nov 17 '05 #1
0 1056

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

Similar topics

3
1948
by: Timo Virkkala | last post by:
I tried to install Cheetah (0.9.15) and ran into trouble. When running the test suite, I get 61 failures and 57 errors. Most of the errors are "ImportError: No module named temp", with some...
2
1185
by: Jeff Smith | last post by:
I built Python 2.3.4 on AIX 5.1 with the AIX C compiler cc_r and had three test failures during the "make test" phase: test_coercion test_mmap test_pty Do I need to worry about these? Should...
14
2196
by: Spare Change | last post by:
I am told that I can have a dynamic or static string array. So if I declare string dynamic; How do I add elements to dynamic and resize it ?
0
1579
by: db2sysc | last post by:
All: I am trying to enable Performance Trace Class(30,8) IFCID(125) to collect RID failures and generate report with SQLACTIVITY REPORT WORKLOAD(SCAN). Is there any other better way to capture...
15
2045
by: Nak | last post by:
Hi there, Is it possible to load a web service dynamically? i.e. If the web service were to exist on a system with a non static IP address, an application could download a "locator" file that...
7
4216
by: Connie | last post by:
I have a DTS Job that is reporting failures but it looks to me as if the job is actually completing successfully. The job only has a couple steps. Step 1 (DTSStep_DTSExecuteSQLTask_1) Execute SQL...
3
6881
ChaseCox
by: ChaseCox | last post by:
Hi all, I have a problem that I have been looking at for a couple days now and I can not quite get it to work. I would like to calculate the cumulative percent failure of a certain product in...
158
5945
by: jacob navia | last post by:
1: It is not possible to check EVERY malloc result within complex software. 2: The reasonable solution (use a garbage collector) is not possible for whatever reasons. 3: A solution like the...
6
3001
by: =?Utf-8?B?TmljayBCdXJraXR0?= | last post by:
I have an application that uses DsGetDcName() to determine the sites (and domains) of servers in the network. I have found that DsGetDcName() fails rather often, and the reason(s) is not obvious. ...
2
8926
by: Damir | last post by:
Hello! I have noticed that after (sucessfully) executing the command: FLUSH PACKAGE CACHE DYNAMIC the dynamic SQL statement cache is not completely cleared (some of the dynamic SQL statement...
0
7259
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,...
0
7158
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
7535
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...
1
7098
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...
1
5085
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...
0
3221
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1592
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 ...
1
798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
455
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...

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.