Flee with ASP.Net

Mar 6, 2009 at 12:34 AM

I like the demos and I'm trying to get the library to work with ASP.Net (VB.Net). I basically dropped in the code from Sub Main in the demo and it compiles fine but throws

System.IO.IOException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

[IOException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))]
System.Reflection.Module._InternalSavePEFile(String fileName, Int32 entryPoint, Int32 isExe, Boolean isManifestFile) +0
System.Reflection.Module.InternalSavePEFile(String fileName, MethodToken entryPoint, Int32 isExe, Boolean isManifestFile) +32
System.Reflection.Emit.ModuleBuilder.SaveNoLock(String fileName, Boolean isAssemblyFile, PortableExecutableKinds portableExecutableKind, ImageFileMachine imageFileMachine) +439
System.Reflection.Emit.ModuleBuilder.Save(String fileName, Boolean isAssemblyFile, PortableExecutableKinds portableExecutableKind, ImageFileMachine imageFileMachine) +103
System.Reflection.Emit.AssemblyBuilder.SaveNoLock(String assemblyFileName, PortableExecutableKinds portableExecutableKind, ImageFileMachine imageFileMachine) +3149
System.Reflection.Emit.AssemblyBuilder.Save(String assemblyFileName, PortableExecutableKinds portableExecutableKind, ImageFileMachine imageFileMachine) +97
Ciloci.Flee.Expression`1.EmitToAssembly(ExpressionElement rootElement, IServiceContainer services) +312

when it gets to

 Dim e As IDynamicExpression = context.CompileDynamic(strIn)

I have the source code and was hoping that someone would be able to give me a nudge in the right direction toward fixing this either with permission corrections in the filesystem or with permission changes in the actual code or whereever this error is being generated.

Thanks, Bobbie

Coordinator
Mar 6, 2009 at 4:34 PM
Sounds like you have ExpressionOptions.EmitToAssembly set to true which will cause Flee to create an assembly on disk.  Since, by default, ASP.NET applications don't have write access to the file system, you get an IO error.

The fix would be to leave the EmitToAsssembly option to its default value of false.  It's mostly meant for debugging purposes anyways and setting it to true won't improve performance.