473,395 Members | 1,696 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,395 software developers and data experts.

Method in compiled assembly throws exceptions

Hello,

this is a bit of a complicated issue, I'll try to be succinct.

1) my application allows people to add 'scripts' to it.
2) these scripts are written in VB.NET or C#.NET language, and they are compiled into memory-assemblies on the fly using VBCodeProvider.CompileAssemblyFromSource()
3) I use Assembly.GetType() to get the type code for the 'script' class in these assemblies.
4) Then I make a new instance of this type using System.Activator.CreateInstance()
5) finally I cast this System.Object to an Interface I know it implements and call methods on this instance.

This all works fine.

Now, I added the option for users to add reference assemblies to these scripts. They pick a dll somewhere off the disk, and I add that file path to the CompilerParameters() field. The compile operation still works fine (no compiler errors or warnings), but as soon as I try and call a method on the instantiated type, I get the following error:

"Could not load file or assembly 'MathSeries, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified"

The MathSeries dll is just something I made to test this feature. It's a bog-standard Class Library with a single class which has the default references as set up by VS2005.

I tried handling the ModuleResolve event on the assembly, but it's never called.

Any ideas are most welcome.

Thanks,
David

--
David Rutten
Oct 24 '08 #1
0 983

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Chris | last post by:
Hi I have a scenario where I've created another AppDomain to dynamically load a DLL(s) into. In this newly loaded DLL I want to call a static method on a class. The problem arise is that I have...
9
by: keith | last post by:
I created a class libery which has name space Assembly and class Assembly and compiled it. Then created a C# project and called a method in the external class e.g. Assembly dll;...
2
by: Martin Maat | last post by:
Hi, I am trying to create a plug-in assembly without the need to register it in the GAC. Reflection should help me out here. I got this far: private void button1_Click(object sender,...
0
by: Mike Schilling | last post by:
I have some code that calls methods reflectively (the method called and its parameters are determined by text received in a SOAP message, and I construct a map from strings to MethodInfos). The...
11
by: vijaynats | last post by:
Why isn't there a 'throws' keyword in C# like java - i would like to declare a function and say - public int addup(int a, int b) throws ArithmeticExceptio, DivideByZeroException { ... ... }
4
by: Kevin Frey | last post by:
I have the following situation: Assembly #1: class NativeSearchCriteria // NOTE: a native class { }; public ref class TheBaseClass {
5
by: ajos | last post by:
hi frnds, im seperating html views, which is inside my servlets into a seperate jsp.the servlet contains certain exception methods that shows certain exceptions(if present)..the servlet...
4
by: datastrc | last post by:
Hello When compiling the following example #include <cstdlib> //declarations of malloc and free #include <new> #include <iostream> using namespace std; class C {
9
by: paul | last post by:
Hi I would like to extract all possible exceptions for a particular method. Ideally this would be a Visual Studio 2005 Add-In and would allow a developer to highlight a any method, pressing a...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.