[Mono-dev] System.Reflection.Assemby:LoadFrom question

Arnhoffer Károly karnhoffer at ecron.hu
Tue Jan 3 09:40:25 EST 2006

I try to compile runtime the VB code below:

Option Strict On
Imports WFObj
Imports NCore
Imports NPartner
Imports NFilter
Imports System.Windows.Forms
Imports Microsoft.VisualBasic
Public Module WFProcedure_225737
        Public Function WFExpression_226217(CurrentApp As WFApp, 
CurrentConnection As DB.Connection, CurrentOccurence As WF Occurence, CurrentCase As WFCase, CurrentElement As WFElement, 
CurrentAddressee As Person, Optional ByRef CurrentFieldValue
 As Object = Nothing) As Object
                Dim ALAIRO1 As Integer = CInt(WFFieldValue. CalculateValue(CurrentApp, CurrentConnection, "ALAIRO1", Current Occurence, CurrentCase, CurrentElement))
                Return ALAIRO1<>0
        End Function
End Module

With this code:

lobjCParams = New CompilerParameters()
lobjCProvider = New Microsoft.VisualBasic.VBCodeProvider()

With lobjCParams
	.GenerateExecutable = False
	.GenerateInMemory = True
	.IncludeDebugInformation = False
      If Not tstraReferences Is Nothing AndAlso tstraReferences.Length > 0 Then
      	For I = 0 To tstraReferences.Length - 1
            	If Not IsES(tstraReferences(I)) Then
                  End If
      End If
      .TempFiles = New TempFileCollection(IO.Path.Combine("/tmp", "compile"), True)

      .TreatWarningsAsErrors = False
End With

	tobjResults = lobjCProvider.CreateCompiler.CompileAssemblyFromSource(lobjCParams, tstrSource) 
Catch ex As Exception 
End Try

There is an error and I get this stack trace:

ERROR: Could not find file "/tmp/compile/69597.dll".  ()  1/3/2006 3:29: 59 PM

in <0x00000> <unknown method>
in (wrapper managed-to-native) System.Reflection.Assembly:LoadFrom (string,bool) 
in <0x0000c> System.Reflection.Assembly:LoadFrom (System.String assemblyFile) 
in <0x00388> Microsoft.VisualBasic.VBCodeCompiler:CompileFromFileBatch (System.CodeDom.Compiler.CompilerParameters options, System.String[] fileNames) 
in <0x00171> Microsoft.VisualBasic.VBCodeCompiler:CompileFromSourceBatch (System.CodeDom.Compiler.CompilerParameters options, System.String[] sources) 
in <0x00022> Microsoft.VisualBasic.VBCodeCompiler:CompileAssemblyFromSourceBatch (System.CodeDom.Compiler. CompilerParameter s options, System.String[] sources) 
in <0x0003c> Microsoft.VisualBasic.VBCodeCompiler:CompileAssemblyFromSource (System.CodeDom.Compiler. CompilerParameters opt ions, System.String source) 

When I use 	.GenerateInMemory = False VB files are generated under /tmp/compile/ but dlls not again.

What is wrong here?


More information about the Mono-devel-list mailing list