Jimmy,
So I decided to debug this out a bit for myself. Before I go too far, here
is how my require headers are setup:
require 'System.Xml.Linq, Version=3.5.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089'
require 'System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089'
require 'System.Data, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089'
require 'System.Xml, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089'
require 'System.Drawing, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a'
require 'System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089'
require
'C:\Users\pinvoke\Desktop\Rspec_Project_Runner\cmd_parser\bin\Debug\CmdParser.dll'
require
'C:\Users\pinvoke\Desktop\Rspec_Project_Runner\rspec_project_runner\bin\Debug\rspec_project_runner.exe'
Inside of my IronRuby specs, there is a call that, in ruby looks like this:
rargs = ['-o', 'C:\Users\pinvoke']
args = System::Array[System::String].new(rargs)
p = Rspec::Project::Runner::ProgramArguments.Parse(args)
The call to assign the results of Parse to P always fails unless I
a) Do what Ivan suggested and copy to the bin folder
b.) Modify ir.exe.config to include the path to the actual .dll
-
I was reading the source code this evening and noticed that during the
RubyContext buildup it only includes the following paths to resolve
references:
context.Loader.GetLoadPathStrings()
{string[4]}
[0]: "F:/ironruby-ironruby-178b744/Merlin/Main/Languages/Ruby/libs/"
[1]:
"F:/ironruby-ironruby-178b744/Merlin/External.LCA_RESTRICTED/Languages/Ruby/redist-libs/ruby/site_ruby/1.8/"
[2]:
"F:/ironruby-ironruby-178b744/Merlin/External.LCA_RESTRICTED/Languages/Ruby/redist-libs/ruby/1.8/"
[3]: "."
I assumed this is was why if I dump my .dll into any of those paths it
resolves.
Then when I looked at the loaded files, everything looked like it loaded
correctly:
[2]: "System.Xml.Linq, Version=3.5.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"
[3]: "System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"
[4]: "System.Data, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"
[5]: "System.Xml, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"
[6]: "System.Drawing, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a"
[7]: "System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"
[8]:
"C:\\\\Users\\\\pinvoke\\\\Desktop\\\\Rspec_Project_Runner\\\\cmd_parser\\\\bin\\\\Debug\\\\CmdParser.dll"
[9]:
"C:\\\\Users\\\\pinvoke\\\\Desktop\\\\Rspec_Project_Runner\\\\Specs\\\\CmdParser_spec_helper.rb"
[10]:
"C:\\\\Users\\\\pinvoke\\\\Desktop\\\\Rspec_Project_Runner\\\\rspec_project_runner\\\\bin\\\\Debug\\\\rspec_project_runner.exe"
[11]: "rspec_project_runner_spec_helper.rb"
Here is where it gets fun!
The problem appears to be in the way IronRuby is resolving assembly
references from other already loaded assemblies. That is, if I make the
above spec calls (rargs /args/ p) the application blows up w/o the CmdParser
assembly in the path. The thing is that all the .Parse(args) method call is
doing is a wrapper to call into another assembly... the one that blows up as
not being found.
So, I decided to see what happened if I call the methods from the CmdParser
assembly directly and... everything works fine. Regardless of which path
the file is in :)
If I wasn't so tired I would try and trace back how the resolve was working
and why it wasn't checking the loaded files... however I am exhausted and
it's way past my bed time.
If this helps, here is the Fusion Log that got dumped:
=== Pre-bind state information ===
LOG: User = veritas\pinvoke
LOG: DisplayName = CmdParser, Version=1.5.0.0, Culture=neutral,
PublicKeyToken=null
(Fully-specified)
LOG: Appbase = file:///F:/ironruby-ironruby-178b744/Merlin/Main/bin/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file:
F:\ironruby-ironruby-178b744\Merlin\Main\bin\Debug\ir.exe.Config
LOG: Using machine configuration file from
C:\Windows\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom,
partial, or location-based assembly bind).
LOG: The same bind was seen before, and was failed with hr = 0x80070002.
-Andrew
--
When I wrote this, only God and I understood what I was doing. Now, God
only knows - Karl Weierstrass
_______________________________________________
Ironruby-core mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core