qlua / luainterface

Automatically exported from code.google.com/p/luainterface
0 stars 0 forks source link

ObjectTranslator.LoadAssembly never reaches Assembly.Load call. #17

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a new lua script
2. Attempt to load an assembly using a library file path("MyCustomLib.dll").

Expected:
When providing a library file path rather than an assembly name to the 
luanet.load_assembly method, LuaInterface should attempt to load the library 
file specified.

Actual:
The code that is intended to load libraries by file path is never reached.  The 
LoadAssembly method attempts to load via Assembly.LoadWithPartialName, which 
exceptions due to an invalid assembly name (file path).  This exception 
prevents the Assembly.Load(AssemblyName.GetAssemblyName("")) call from 
occurring.

Fix:
The LoadAssembly logic needs to be refactored for better handling of the 
exception caused by attempting to pass a file path to the LoadWithPartialName 
method so that the Assembly.Load call can be reached when appropriate.

Original issue reported on code.google.com by eonstorm@gmail.com on 30 Jun 2010 at 8:35

GoogleCodeExporter commented 9 years ago

Original comment by eonstorm@gmail.com on 1 Jul 2010 at 5:33

GoogleCodeExporter commented 9 years ago
Fixed in r15.

Original comment by eonstorm@gmail.com on 1 Jul 2010 at 5:37

GoogleCodeExporter commented 9 years ago
The changes done in r15 broke the shortcut notations to the luanet object:

luanet.System.Windows.Forms.MessageBox.Show("Test")

worked before these changes, after them it doesn't work anymore. This is rather 
awkward because in the binary download (ver. 2.0.3.7) this bug doesn't exist 
yet, so using the binary works, but downloading and compiling it myself got me 
this interesting bug.

This still works after the change:
luanet["System.Windows.Forms.MessageBox"].Show("Test")

This is because load_assembly now raises an exception instead of failing 
silently and the init_luanet code in Lua.cs relied on this behaviour.

I fixed it in my version by simply commenting out the throwError() call in the 
ObjectTranslator.cs:loadAssembly() function. There are propably better ways to 
fix this.

Original comment by Luelis...@gmail.com on 22 Feb 2012 at 3:08