Exception

S

Saradhi

Hi All,

I wrote this piece of code:

private bool Compile(ArrayList sourceList,ArrayList referencesList)
{
bool bResult = false;
Microsoft.VisualBasic.VBCodeProvider provider;
System.CodeDom.Compiler.ICodeCompiler compiler;
System.CodeDom.Compiler.CompilerParameters compilerparams;
System.CodeDom.Compiler.CompilerResults results;

compilerparams = new System.CodeDom.Compiler.CompilerParameters();
compilerparams.GenerateInMemory = false;
compilerparams.TreatWarningsAsErrors = false;
compilerparams.WarningLevel = 4;
compilerparams.IncludeDebugInformation = false;

// Prepare the Sources list
string[] sources = (string[]) sourceList.ToArray(typeof(string));
//Put any references you need here
string[] refs = (string[])referencesList.ToArray(typeof(string));
compilerparams.ReferencedAssemblies.AddRange(refs);
provider = new Microsoft.VisualBasic.VBCodeProvider();
compiler = provider.CreateCompiler();
results = compiler.CompileAssemblyFromSourceBatch(compilerparams,sources);

// If there are any errros, Fire the Event by sending the CompilerResults Info whcih will be
// caught in the Code Editor.
if (results.Errors.Count != 0 )
{
bResult = false;
// Hanlde Errors.
}
else
{
bResult = true;
m_Assembly = results.CompiledAssembly;
}

return bresult;

}

I am using this function in some of my project and sending the source files and reference list dynamically.

For the First time , If I sent 4 files , the Compiler compiles and gives me the Assembly without any problem.
Next Time, if I add another file and send 5 files, it compiles the 5 files very well , but when I tried to access the CompiledAssembly, it is rising the following EXception "File or assembly name xl0oo7b2.dll, or one of its dependencies, was not found."

at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Boolean isStringized, Evidence assemblySecurity, Boolean throwOnFileNotFound, Assembly locationHint, StackCrawlMark& stackMark)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Boolean stringized, Evidence assemblySecurity, StackCrawlMark& stackMark)
at System.Reflection.Assembly.Load(AssemblyName assemblyRef, Evidence assemblySecurity)
at System.CodeDom.Compiler.CompilerResults.get_CompiledAssembly()
at System.CodeDom.Compiler.CompilerResults.get_CompiledAssembly()

Any idea?


-SARADHI
 
P

pesso

Apparently one of the files on which you're reflecting is missing a
dependency file, xl0oo7b2.dll.
Get the file copy it to the working directory.

Hi All,
I wrote this piece of code:


I am using this function in some of my project and sending the source files
and reference list dynamically.
For the First time , If I sent 4 files , the Compiler compiles and gives me
the Assembly without any problem.
Next Time, if I add another file and send 5 files, it compiles the 5 files
very well , but when I tried to access the CompiledAssembly, it is rising
the following EXception "File or assembly name xl0oo7b2.dll, or one of its dependencies, was not found."

at System.Reflection.Assembly.nLoad(AssemblyName fileName, String
codeBase, Boolean isStringized, Evidence assemblySecurity, >Boolean
throwOnFileNotFound, Assembly locationHint, StackCrawlMark& stackMark)
 
S

Saradhi

How do I know the DEpendancy files before I compile any bunch of Source files?

Apparently one of the files on which you're reflecting is missing a
dependency file, xl0oo7b2.dll.
Get the file copy it to the working directory.

Hi All,
I wrote this piece of code:


I am using this function in some of my project and sending the source files
and reference list dynamically.
For the First time , If I sent 4 files , the Compiler compiles and gives me
the Assembly without any problem.
Next Time, if I add another file and send 5 files, it compiles the 5 files
very well , but when I tried to access the CompiledAssembly, it is rising
the following EXception "File or assembly name xl0oo7b2.dll, or one of its dependencies, was not found."

at System.Reflection.Assembly.nLoad(AssemblyName fileName, String
codeBase, Boolean isStringized, Evidence assemblySecurity, >Boolean
throwOnFileNotFound, Assembly locationHint, StackCrawlMark& stackMark)
 
S

Saradhi

Further to the problem, if I use the sources[] hotcoded in my program, it works,
The problems lies only when I calls them dynamically using the sources,

What might be happening is that the system might internally be dropping the reference to the previous compile (revoking the cache). Just a guess, but it might be the case.

Any body has any ideas?

Hi All,

I wrote this piece of code:

private bool Compile(ArrayList sourceList,ArrayList referencesList)
{
bool bResult = false;
Microsoft.VisualBasic.VBCodeProvider provider;
System.CodeDom.Compiler.ICodeCompiler compiler;
System.CodeDom.Compiler.CompilerParameters compilerparams;
System.CodeDom.Compiler.CompilerResults results;

compilerparams = new System.CodeDom.Compiler.CompilerParameters();
compilerparams.GenerateInMemory = false;
compilerparams.TreatWarningsAsErrors = false;
compilerparams.WarningLevel = 4;
compilerparams.IncludeDebugInformation = false;

// Prepare the Sources list
string[] sources = (string[]) sourceList.ToArray(typeof(string));
//Put any references you need here
string[] refs = (string[])referencesList.ToArray(typeof(string));
compilerparams.ReferencedAssemblies.AddRange(refs);
provider = new Microsoft.VisualBasic.VBCodeProvider();
compiler = provider.CreateCompiler();
results = compiler.CompileAssemblyFromSourceBatch(compilerparams,sources);

// If there are any errros, Fire the Event by sending the CompilerResults Info whcih will be
// caught in the Code Editor.
if (results.Errors.Count != 0 )
{
bResult = false;
// Hanlde Errors.
}
else
{
bResult = true;
m_Assembly = results.CompiledAssembly;
}

return bresult;

}

I am using this function in some of my project and sending the source files and reference list dynamically.

For the First time , If I sent 4 files , the Compiler compiles and gives me the Assembly without any problem.
Next Time, if I add another file and send 5 files, it compiles the 5 files very well , but when I tried to access the CompiledAssembly, it is rising the following EXception "File or assembly name xl0oo7b2.dll, or one of its dependencies, was not found."

at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Boolean isStringized, Evidence assemblySecurity, Boolean throwOnFileNotFound, Assembly locationHint, StackCrawlMark& stackMark)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Boolean stringized, Evidence assemblySecurity, StackCrawlMark& stackMark)
at System.Reflection.Assembly.Load(AssemblyName assemblyRef, Evidence assemblySecurity)
at System.CodeDom.Compiler.CompilerResults.get_CompiledAssembly()
at System.CodeDom.Compiler.CompilerResults.get_CompiledAssembly()

Any idea?


-SARADHI
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top