473,655 Members | 3,072 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
preferredConnec tionType) ";
[...snip...]
CompilerParamet ers Parameters = new CompilerParamet ers ();
Parameters.Gene rateExecutable = false;
Parameters.Gene rateInMemory = true;
Parameters.Outp utAssembly = "Dummy.dll" ;
CodeDomProvider Compiler = CodeDomProvider .CreateProvider
("csharp");
CompilerResults CompResult = Compiler.Compil eAssemblyFromSo urce
(Parameters, new string[] { Code });
Assembly TheAssembly = CompResult.Comp iledAssembly;

When I execute this and want to access the CompResult, I either get a
FileNotFoundExc eption in case there is no DLL with the
Parameters.Outp utAssembly
name in the directory. Or I get a BadImageFormatE xception 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 "PolicyAcce ss" with the method
"GetPolicy" .

What is going wrong here??? I was assuming that if one creates an assembly
with
"GenerateInMemo ry = 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 1071

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

Similar topics

3
1951
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 "TypeError: update() takes exactly one argument (0 given)". The full output of the test suite is at (URL: http://www.cs.helsinki.fi/u/tjvirkka/out.txt ) I'd hate to spend hours debugging this thing, so I thought to ask here if someone has any ideas...
2
1195
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 I submit a bug report? Thanks, Jeff
14
2221
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
1588
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 the RID failures and the threads that are having them through DB2 PM?
15
2056
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 contained details of it's whereabouts, I have been looking at the "Discovery.DynamicDiscoveryDocument" class but I think think this is what I am looking for is it? Thanks in advance. Nick.
7
4235
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 Task, runs a stored procedure to export blobs (pdf files) out of sql server and onto the local machine. Here is the code in the storedprocedure called sp_PDFExport CREATE PROCEDURE . AS begin set quoted_identifier off
3
6889
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 my table. :: Cumulative Percent Failure Example: If you had 100 product shipped, and every month 10 units failed, you would have 10% failure the first month, 20% the second, and so on. The fields in my table that I am concerned with are ,...
158
6030
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 one proposed by Mr McLean (aborting) is not possible for software quality reasons. The program must decide
6
3005
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. The typical error code is RPC_S_SERVER_UNAVAILABLE, although RPC_E_ACCESS_DENIED is popular, as well. Sometimes simply retrying the call will result in success, but more often it does not. What can cause DsGetDcName() to fail (excluding the...
2
8952
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 elements are not reset). For example, looking at the dynamic SQL snapshot I see a certain SQL statement that has been executed a number of times and has read a (big) number of rows. Then I execute the "FLUSH PACKAGE CACHE DYNAMIC" command.
0
8380
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
8296
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8816
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
8598
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
4150
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...
0
4299
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2721
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
2
1928
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1598
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.