I know this is a bit of a longshot, but has anyone got an internalsvisibleto attribute to work so they could debug internal classes from ir itself? I tried to add the namespace "ir" and public key to the assembly I was trying to test to no avail. Im building out some rspec & IronRuby tests of my .net assemblies and it would be nice if I could reach out and touch some internal classes :) -A -- When I wrote this, only God and I understood what I was doing. Now, God only knows - Karl Weierstrass -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20100111/05457b09/attachment.html>
Running IronRuby with the "-X:PrivateBinding" will allow access to private members, which should also work for internal members (I believe, try it out just to be sure and report back). From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of andrew Wilson Sent: Monday, January 11, 2010 9:06 PM To: ironruby-core at rubyforge.org Subject: [Ironruby-core] InternalsVisibleTo I know this is a bit of a longshot, but has anyone got an internalsvisibleto attribute to work so they could debug internal classes from ir itself? I tried to add the namespace "ir" and public key to the assembly I was trying to test to no avail. Im building out some rspec & IronRuby tests of my .net assemblies and it would be nice if I could reach out and touch some internal classes :) -A -- When I wrote this, only God and I understood what I was doing. Now, God only knows - Karl Weierstrass -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20100112/aaad5e6f/attachment-0001.html>
Jimmy, Yes that worked, but it did point out another problem. When I do: My::Domain.constants I have somewhere like 15 references to .dll''s that won''t load unless I copy them off to the bin folder for IronRuby. The references for each of them are to their physical path, so I would have thought that to solve that issue. It''s not a major deal for now, but its kinda hokey copying those files over :) Any ideas? -A On Mon, Jan 11, 2010 at 10:14 PM, <ironruby-core-request at rubyforge.org>wrote:> Send Ironruby-core mailing list submissions to > ironruby-core at rubyforge.org > > To subscribe or unsubscribe via the World Wide Web, visit > http://rubyforge.org/mailman/listinfo/ironruby-core > or, via email, send a message with subject or body ''help'' to > ironruby-core-request at rubyforge.org > > You can reach the person managing the list at > ironruby-core-owner at rubyforge.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Ironruby-core digest..." > > > Today''s Topics: > > 1. InternalsVisibleTo (andrew Wilson) > 2. Re: InternalsVisibleTo (Jimmy Schementi) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Mon, 11 Jan 2010 22:06:23 -0700 > From: andrew Wilson <a.wilson82 at gmail.com> > To: ironruby-core at rubyforge.org > Subject: [Ironruby-core] InternalsVisibleTo > Message-ID: > <9dbb46901001112106r79971abai7de5e677da0ee823 at mail.gmail.com> > Content-Type: text/plain; charset="iso-8859-1" > > I know this is a bit of a longshot, but has anyone got an > internalsvisibleto > attribute to work so they could debug internal classes from ir itself? I > tried to add the namespace "ir" and public key to the assembly I was trying > to test to no avail. > > Im building out some rspec & IronRuby tests of my .net assemblies and it > would be nice if I could reach out and touch some internal classes :) > > -A > > -- > When I wrote this, only God and I understood what I was doing. Now, God > only knows - Karl Weierstrass > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: < > http://rubyforge.org/pipermail/ironruby-core/attachments/20100111/05457b09/attachment-0001.html > > > > ------------------------------ > > Message: 2 > Date: Tue, 12 Jan 2010 05:13:55 +0000 > From: Jimmy Schementi <Jimmy.Schementi at microsoft.com> > To: "ironruby-core at rubyforge.org" <ironruby-core at rubyforge.org> > Subject: Re: [Ironruby-core] InternalsVisibleTo > Message-ID: > < > 1B42307CD4AADD438CDDA2FE1121CC9209E938 at TK5EX14MBXC141.redmond.corp.microsoft.com > > > > Content-Type: text/plain; charset="us-ascii" > > Running IronRuby with the "-X:PrivateBinding" will allow access to private > members, which should also work for internal members (I believe, try it out > just to be sure and report back). > > From: ironruby-core-bounces at rubyforge.org [mailto: > ironruby-core-bounces at rubyforge.org] On Behalf Of andrew Wilson > Sent: Monday, January 11, 2010 9:06 PM > To: ironruby-core at rubyforge.org > Subject: [Ironruby-core] InternalsVisibleTo > > I know this is a bit of a longshot, but has anyone got an > internalsvisibleto attribute to work so they could debug internal classes > from ir itself? I tried to add the namespace "ir" and public key to the > assembly I was trying to test to no avail. > > Im building out some rspec & IronRuby tests of my .net assemblies and it > would be nice if I could reach out and touch some internal classes :) > > -A > > -- > When I wrote this, only God and I understood what I was doing. Now, God > only knows - Karl Weierstrass > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: < > http://rubyforge.org/pipermail/ironruby-core/attachments/20100112/aaad5e6f/attachment.html > > > > ------------------------------ > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > > End of Ironruby-core Digest, Vol 29, Issue 15 > ********************************************* >-- When I wrote this, only God and I understood what I was doing. Now, God only knows - Karl Weierstrass -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20100112/21fa8f9e/attachment.html>
Have you tried requiring them? "require ''foo''" will
look on the path for foo.rb, as well as foo.dll. If you could provide a small
repro of your issue I can give more help.
From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at
rubyforge.org] On Behalf Of andrew Wilson
Sent: Tuesday, January 12, 2010 8:43 AM
To: ironruby-core at rubyforge.org
Subject: Re: [Ironruby-core] InternalsVisibleTo
Jimmy,
Yes that worked, but it did point out another problem. When I do:
My::Domain.constants
I have somewhere like 15 references to .dll''s that won''t load
unless I copy them off to the bin folder for IronRuby. The references for each
of them are to their physical path, so I would have thought that to solve that
issue. It''s not a major deal for now, but its kinda hokey copying
those files over :)
Any ideas?
-A
On Mon, Jan 11, 2010 at 10:14 PM, <ironruby-core-request at
rubyforge.org<mailto:ironruby-core-request at rubyforge.org>> wrote:
Send Ironruby-core mailing list submissions to
ironruby-core at rubyforge.org<mailto:ironruby-core at
rubyforge.org>
To subscribe or unsubscribe via the World Wide Web, visit
http://rubyforge.org/mailman/listinfo/ironruby-core
or, via email, send a message with subject or body ''help'' to
ironruby-core-request at rubyforge.org<mailto:ironruby-core-request at
rubyforge.org>
You can reach the person managing the list at
ironruby-core-owner at rubyforge.org<mailto:ironruby-core-owner at
rubyforge.org>
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Ironruby-core digest..."
Today''s Topics:
1. InternalsVisibleTo (andrew Wilson)
2. Re: InternalsVisibleTo (Jimmy Schementi)
----------------------------------------------------------------------
Message: 1
Date: Mon, 11 Jan 2010 22:06:23 -0700
From: andrew Wilson <a.wilson82 at gmail.com<mailto:a.wilson82 at
gmail.com>>
To: ironruby-core at rubyforge.org<mailto:ironruby-core at rubyforge.org>
Subject: [Ironruby-core] InternalsVisibleTo
Message-ID:
<9dbb46901001112106r79971abai7de5e677da0ee823 at
mail.gmail.com<mailto:9dbb46901001112106r79971abai7de5e677da0ee823 at
mail.gmail.com>>
Content-Type: text/plain; charset="iso-8859-1"
I know this is a bit of a longshot, but has anyone got an internalsvisibleto
attribute to work so they could debug internal classes from ir itself? I
tried to add the namespace "ir" and public key to the assembly I was
trying
to test to no avail.
Im building out some rspec & IronRuby tests of my .net assemblies and it
would be nice if I could reach out and touch some internal classes :)
-A
--
When I wrote this, only God and I understood what I was doing. Now, God
only knows - Karl Weierstrass
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://rubyforge.org/pipermail/ironruby-core/attachments/20100111/05457b09/attachment-0001.html>
------------------------------
Message: 2
Date: Tue, 12 Jan 2010 05:13:55 +0000
From: Jimmy Schementi <Jimmy.Schementi at
microsoft.com<mailto:Jimmy.Schementi at microsoft.com>>
To: "ironruby-core at rubyforge.org<mailto:ironruby-core at
rubyforge.org>" <ironruby-core at
rubyforge.org<mailto:ironruby-core at rubyforge.org>>
Subject: Re: [Ironruby-core] InternalsVisibleTo
Message-ID:
<1B42307CD4AADD438CDDA2FE1121CC9209E938 at
TK5EX14MBXC141.redmond.corp.microsoft.com<mailto:1B42307CD4AADD438CDDA2FE1121CC9209E938
at TK5EX14MBXC141.redmond.corp.microsoft.com>>
Content-Type: text/plain; charset="us-ascii"
Running IronRuby with the "-X:PrivateBinding" will allow access to
private members, which should also work for internal members (I believe, try it
out just to be sure and report back).
From: ironruby-core-bounces at rubyforge.org<mailto:ironruby-core-bounces at
rubyforge.org> [mailto:ironruby-core-bounces at
rubyforge.org<mailto:ironruby-core-bounces at rubyforge.org>] On Behalf Of
andrew Wilson
Sent: Monday, January 11, 2010 9:06 PM
To: ironruby-core at rubyforge.org<mailto:ironruby-core at rubyforge.org>
Subject: [Ironruby-core] InternalsVisibleTo
I know this is a bit of a longshot, but has anyone got an internalsvisibleto
attribute to work so they could debug internal classes from ir itself? I tried
to add the namespace "ir" and public key to the assembly I was trying
to test to no avail.
Im building out some rspec & IronRuby tests of my .net assemblies and it
would be nice if I could reach out and touch some internal classes :)
-A
--
When I wrote this, only God and I understood what I was doing. Now, God only
knows - Karl Weierstrass
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://rubyforge.org/pipermail/ironruby-core/attachments/20100112/aaad5e6f/attachment.html>
------------------------------
_______________________________________________
Ironruby-core mailing list
Ironruby-core at rubyforge.org<mailto:Ironruby-core at rubyforge.org>
http://rubyforge.org/mailman/listinfo/ironruby-core
End of Ironruby-core Digest, Vol 29, Issue 15
*********************************************
--
When I wrote this, only God and I understood what I was doing. Now, God only
knows - Karl Weierstrass
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://rubyforge.org/pipermail/ironruby-core/attachments/20100112/29f8cf44/attachment.html>
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://rubyforge.org/pipermail/ironruby-core/attachments/20100116/85c8138b/attachment-0001.html>
> 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 .dllI would suggest neither of these =P See below.> 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.Resolving DLLs should behave the same way as resolving Ruby libraries; it has to be on the load path. As you saw in the debugger, the load path is preset with the LibraryPaths value that is in the config, but it''s preferred to modify the load path by appending string to the $LOAD_PATH (or $: shorthand) variable, rather than modifying the config file. Consider the following directory structure: /dlls/foo.dll /bar.rb Where foo.dll was compiled from this C# code: public class Foo { public static void Bar() { System.Console.WriteLine("In Bar"); } } If foo.rb just looked like this: require ''foo.dll'' Foo.bar ... and ir.exe is anywhere but the dlls directory you''d get this error: PS C:\temp> ir .\bar.rb :0:in `require'': no such file to load -- foo (LoadError) from ./bar.rb:1 However, if you add "dlls" to the load path first: $LOAD_PATH << File.dirname(__FILE__) + "/dlls" require ''foo.dll'' Foo.bar Then all will work: PS C:\temp> ir .\bar.rb In Bar Notice that the first line "File.dirname(__FILE__)" to make the "dlls" path relative to the current file. Then doing "require ''foo''" will look in the dlls directory. Does that solve your problem? ~Jimmy