Mohammad Azam
2010-Jun-21 15:39 UTC
[Ironruby-core] WatiN .NET 4.0 and the loadFromRemoteSources Element in App.config
I am using .NET 4.0 with IronRuby to invoke some methods on WatiN framework 2.0.10.928. I keep getting the following error when loading the WatiN assemblies: C:\Projects\IronRubyDemo\IronRubyDemoSolution\BusinessObjects>ir -S spec testacc ountbalanceUI.rb C:/IronRuby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:30:in `require'': A n attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so thi s load may be dangerous. If this load is not intended to sandbox the assembly, p lease enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlin k/?LinkId=155569 for more information. (LoadError) from C:/IronRuby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:30:in `require'' So, I went to the App.config file of my project and added the following lines: <?xml version="1.0" encoding="utf-8" ?> <configuration> <runtime> <loadFromRemoteSources enabled="true" /> </runtime> </configuration> I tried running it again and encountered the same problem. Any ideas! -- Mohammad Azam MVP (Microsoft Valuable Professional) www.highoncoding.com www.azamsharp.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20100621/dba03b40/attachment.html>
Will Green
2010-Jun-21 15:46 UTC
[Ironruby-core] WatiN .NET 4.0 and the loadFromRemoteSources Element in App.config
Your app is not the thing trying to load that assembly, IronRuby is. So, you''ll need to add that to IronRuby''s app.config. That said, why are you trying to load an assembly from a network location in your tests? That is, IMO bad testing practice. -- Will Green http://hotgazpacho.org/ On Mon, Jun 21, 2010 at 11:39 AM, Mohammad Azam <azamsharp at gmail.com> wrote:> I am using .NET 4.0 with IronRuby to invoke some methods on WatiN framework > 2.0.10.928. > > I keep getting the following error when loading the WatiN assemblies: > > > C:\Projects\IronRubyDemo\IronRubyDemoSolution\BusinessObjects>ir -S spec > testacc > ountbalanceUI.rb > C:/IronRuby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:30:in > `require'': A > n attempt was made to load an assembly from a network location which would > have > caused the assembly to be sandboxed in previous versions of the .NET > Framework. > This release of the .NET Framework does not enable CAS policy by default, > so thi > s load may be dangerous. If this load is not intended to sandbox the > assembly, p > lease enable the loadFromRemoteSources switch. See > http://go.microsoft.com/fwlin > k/?LinkId=155569 for more information. (LoadError) > from > C:/IronRuby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:30:in > `require'' > > > So, I went to the App.config file of my project and added the following > lines: > > <?xml version="1.0" encoding="utf-8" ?> > <configuration> > > <runtime> > <loadFromRemoteSources enabled="true" /> > </runtime> > > </configuration> > > I tried running it again and encountered the same problem. Any ideas! > -- > Mohammad Azam > MVP (Microsoft Valuable Professional) > www.highoncoding.com > www.azamsharp.com > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20100621/87a1a19e/attachment.html>
Mohammad Azam
2010-Jun-21 15:49 UTC
[Ironruby-core] WatiN .NET 4.0 and the loadFromRemoteSources Element in App.config
Will Green wrote:> Your app is not the thing trying to load that assembly, IronRuby is. So, > you''ll need to add that to IronRuby''s app.config. > > That said, why are you trying to load an assembly from a network > location in > your tests? That is, IMO bad testing practice. > > -- > Will Green > http://hotgazpacho.org/I am not sure what you mean by IronRuby app.config. Where is IronRuby app.config located? I guess it should be in the installed folder of IronRuby. Also, I am just loading an assembly from my local machine. -- Posted via http://www.ruby-forum.com/.
Mohammad Azam
2010-Jun-21 15:51 UTC
[Ironruby-core] WatiN .NET 4.0 and the loadFromRemoteSources Element in App.config
Thanks for the help! I edited the IronRuby configuration file and now the error has disappeared. -- Posted via http://www.ruby-forum.com/.
Ivan Porto Carrero
2010-Jun-21 15:56 UTC
[Ironruby-core] WatiN .NET 4.0 and the loadFromRemoteSources Element in App.config
wherever you installed ironruby. it''s called ir.exe.config for me in C:\ironruby\bin --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero On Mon, Jun 21, 2010 at 5:49 PM, Mohammad Azam <lists at ruby-forum.com> wrote:> Will Green wrote: > > Your app is not the thing trying to load that assembly, IronRuby is. So, > > you''ll need to add that to IronRuby''s app.config. > > > > That said, why are you trying to load an assembly from a network > > location in > > your tests? That is, IMO bad testing practice. > > > > -- > > Will Green > > http://hotgazpacho.org/ > > I am not sure what you mean by IronRuby app.config. Where is IronRuby > app.config located? I guess it should be in the installed folder of > IronRuby. > > Also, I am just loading an assembly from my local machine. > > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20100621/c5c465dd/attachment.html>
Mohammad Azam
2010-Jun-21 16:06 UTC
[Ironruby-core] WatiN .NET 4.0 and the loadFromRemoteSources Element in App.config
Got the first problem solved by editing the configuration file. Now, facing problem loading the Interop.SHDocVw assembly. Here is the complete code: require ''rubygems'' require ''spec'' require File.dirname(__FILE__) + ''/bin/Debug/BusinessObjects.dll'' require File.dirname(__FILE__) + ''/bin/Debug/WatiN.Core.dll'' require File.dirname(__FILE__) + ''/bin/Debug/Microsoft.mshtml.dll'' require File.dirname(__FILE__) + ''/bin/Debug/Interop.SHDocVw.dll'' include BusinessObjects include WatiN describe Account, "when something happens" do before do IE = WatiN::Core::IE @ie = IE.new end it "should do something" do end end And here is the error: C:\Projects\IronRubyDemo\IronRubyDemoSolution\BusinessObjects>ir -S spec testacc ountbalanceUI.rb F 1) Errno::ENOENT in ''BusinessObjects::Account when something happens should do some thing'' Could not load file or assembly ''Interop.SHDocVw, Version=1.1.0.0, Culture=neutr al, PublicKeyToken=db7cfd3acb5ad44e'' or one of its dependencies. The system cann ot find the file specified. ./testaccountbalanceUI.rb:18: Finished in 0.148009 seconds 1 example, 1 failure -- Posted via http://www.ruby-forum.com/.
Mohammad Azam
2010-Jun-21 16:13 UTC
[Ironruby-core] WatiN .NET 4.0 and the loadFromRemoteSources Element in App.config
I created a new project in Visual Studio 2008 and tried running the same code and it worked without any problems. It did not gave me load error for the Interop.SHDocVw.dll. Looks like there are some issues with WatiN when using it on .NET 4.0 framework. -- Posted via http://www.ruby-forum.com/.
Mohammad Azam
2010-Jun-21 16:20 UTC
[Ironruby-core] WatiN .NET 4.0 and the loadFromRemoteSources Element in App.config
Actually facing the same problem on VS 2008. -- Posted via http://www.ruby-forum.com/.
Ivan Porto Carrero
2010-Jun-21 16:32 UTC
[Ironruby-core] WatiN .NET 4.0 and the loadFromRemoteSources Element in App.config
instead of requiring the files with path. maybe try to set the load path $:.unshift( File.dirname(__FILE__) + "/bin/Debug") require ''BusinessObjects.dll'' require ''WatiN.Core.dll'' require ''Microsoft.mshtml.dll'' require ''Interop.SHDocVw.dll'' I also think that the last 2 are redundant.. they should get picked up automatically by Watin.Core isn''t it --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Web: http://whiterabbitconsulting.eu - http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) Microsoft IronRuby/C# MVP On Mon, Jun 21, 2010 at 6:20 PM, Mohammad Azam <lists at ruby-forum.com> wrote:> Actually facing the same problem on VS 2008. > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20100621/64c6ada3/attachment.html>
Mohammad Azam
2010-Jun-21 16:54 UTC
[Ironruby-core] WatiN .NET 4.0 and the loadFromRemoteSources Element in App.config
Ivan Porto Carrero wrote:> instead of requiring the files with path. maybe try to set the load path > > $:.unshift( File.dirname(__FILE__) + "/bin/Debug") > require ''BusinessObjects.dll'' > require ''WatiN.Core.dll'' > require ''Microsoft.mshtml.dll'' > require ''Interop.SHDocVw.dll'' > > I also think that the last 2 are redundant.. they should get picked up > automatically by Watin.Core isn''t it > --- > Met vriendelijke groeten - Best regards - Salutations > Ivan Porto Carrero > Web: http://whiterabbitconsulting.eu - http://flanders.co.nz > Twitter: http://twitter.com/casualjim > Author of IronRuby in Action (http://manning.com/carrero) > Microsoft IronRuby/C# MVPYou are right! It should be loaded automatically but for some reason it is not. Here is my IronRuby code: require ''rubygems'' require ''spec'' require File.dirname(__FILE__) + ''/bin/Debug/BusinessObjects.dll'' require File.dirname(__FILE__) + ''/bin/Debug/WatiN.Core.dll'' include BusinessObjects include WatiN describe Account, "when something happens" do before do IE = WatiN::Core::IE i = IE.new() end it "should do something" do end end And here is the error I get: C:\Projects\TestingIronRuby\BusinessObjects\BusinessObjects>ir -S spec testaccou ntbalanceUI.rb F 1) Errno::ENOENT in ''BusinessObjects::Account when something happens should do some thing'' Could not load file or assembly ''Interop.SHDocVw, Version=1.1.0.0, Culture=neutr al, PublicKeyToken=db7cfd3acb5ad44e'' or one of its dependencies. The system cann ot find the file specified. ./testaccountbalanceUI.rb:19: Finished in 0.150009 seconds 1 example, 1 failure -- Posted via http://www.ruby-forum.com/.
Mohammad Azam
2010-Jun-21 17:04 UTC
[Ironruby-core] WatiN .NET 4.0 and the loadFromRemoteSources Element in App.config
Ivan Porto Carrero wrote:> instead of requiring the files with path. maybe try to set the load path > > $:.unshift( File.dirname(__FILE__) + "/bin/Debug") > require ''BusinessObjects.dll'' > require ''WatiN.Core.dll'' > require ''Microsoft.mshtml.dll'' > require ''Interop.SHDocVw.dll'' > > I also think that the last 2 are redundant.. they should get picked up > automatically by Watin.Core isn''t it > --- > Met vriendelijke groeten - Best regards - Salutations > Ivan Porto Carrero > Web: http://whiterabbitconsulting.eu - http://flanders.co.nz > Twitter: http://twitter.com/casualjim > Author of IronRuby in Action (http://manning.com/carrero) > Microsoft IronRuby/C# MVPHi Ivan, I tried it without the path and it worked instantly. Why is it different? I mean why does it not work when I include the path and why does it work when I set the load path? -- Posted via http://www.ruby-forum.com/.
Ivan Porto Carrero
2010-Jun-21 17:45 UTC
[Ironruby-core] WatiN .NET 4.0 and the loadFromRemoteSources Element in App.config
The load path basically determines where ir.exe looks for assemblies and files to load. if you do $LOAD_PATH.unshift(File.dirname(__FILE__) +"/bin/Debug") and then require Watin.Core.dll the CLR knows where to look for your DLL''s including the referenced assemblies You might have gotten a correct result by including your assemblies in the inverted order too So either you do : $LOAD_PATH.unshift(File.dirname(__FILE__) +"/bin/Debug") require ''BusinessObjects.dll'' require ''WatiN.Core.dll'' or this might work too: require File.dirname(__FILE__) +"/bin/Debug/Interop.SHDocVw.dll" require File.dirname(__FILE__) +"/bin/Debug/Microsoft.mshtml.dll" require File.dirname(__FILE__) +"/bin/Debug/BusinessObjects.dll" require File.dirname(__FILE__) +"/bin/Debug/WatiN.Core.dll" --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero On Mon, Jun 21, 2010 at 6:54 PM, Mohammad Azam <lists at ruby-forum.com> wrote:> Ivan Porto Carrero wrote: > > instead of requiring the files with path. maybe try to set the load path > > > > $:.unshift( File.dirname(__FILE__) + "/bin/Debug") > > require ''BusinessObjects.dll'' > > require ''WatiN.Core.dll'' > > require ''Microsoft.mshtml.dll'' > > require ''Interop.SHDocVw.dll'' > > > > I also think that the last 2 are redundant.. they should get picked up > > automatically by Watin.Core isn''t it > > --- > > Met vriendelijke groeten - Best regards - Salutations > > Ivan Porto Carrero > > Web: http://whiterabbitconsulting.eu - http://flanders.co.nz > > Twitter: http://twitter.com/casualjim > > Author of IronRuby in Action (http://manning.com/carrero) > > Microsoft IronRuby/C# MVP > > > You are right! It should be loaded automatically but for some reason it > is not. Here is my IronRuby code: > > > require ''rubygems'' > require ''spec'' > > require File.dirname(__FILE__) + ''/bin/Debug/BusinessObjects.dll'' > require File.dirname(__FILE__) + ''/bin/Debug/WatiN.Core.dll'' > > include BusinessObjects > include WatiN > > describe Account, "when something happens" do > > before do > > IE = WatiN::Core::IE > > i = IE.new() > > end > > it "should do something" do > > > > end > > end > > > > And here is the error I get: > > C:\Projects\TestingIronRuby\BusinessObjects\BusinessObjects>ir -S spec > testaccou > ntbalanceUI.rb > F > > 1) > Errno::ENOENT in ''BusinessObjects::Account when something happens should > do some > thing'' > Could not load file or assembly ''Interop.SHDocVw, Version=1.1.0.0, > Culture=neutr > al, PublicKeyToken=db7cfd3acb5ad44e'' or one of its dependencies. The > system cann > ot find the file specified. > ./testaccountbalanceUI.rb:19: > > Finished in 0.150009 seconds > > 1 example, 1 failure > > > > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20100621/3d4af432/attachment-0001.html>