The folder SL is installed into is the version; if you're using SL2 it should 
be C:\Program Files\Microsoft Silverlight\2.0.40115.0\. SL3 Beta is C:\Program 
Files\Microsoft Silverlight\3.0.40307.0\.

http://jimmy.schementi.com/silverlight/repro-defined.zip

Unzip that and double-click on the index.html file. The first line of app.xap 
is defined?(System::Windows::Forms), and works fine. It also works in the 
console. Let me know what happens for you.

~js

From: ironruby-core-boun...@rubyforge.org 
[mailto:ironruby-core-boun...@rubyforge.org] On Behalf Of Thibaut Barrère
Sent: Thursday, April 02, 2009 2:57 AM
To: ironruby-core@rubyforge.org
Subject: Re: [Ironruby-core] defined?(xxx) behaves differently when called from 
Silverlight

Hi,

I believe I need to give you more context about what I'm doing. In Magic (see 
here<http://github.com/thbar/magic/blob/faf98c3161221e309290e7a6e311adb27fddf825/lib/magic.rb#L32>
 in particular) I currently have a single file providing support for WPF, 
Silverlight and Windows Forms. I use defined? to determine if one of these are 
available and adopt adequate behaviour.

So that's why I run defined?(System::Windows::Forms::Control) inside 
Silverlight. I can definitely think about alternatives (such as creating a 
specific file for each scenario) - I could do that but I'm trying to stay with 
a single file and avoid metaprogramming for the moment as it's much simpler to 
test.

So back to the issue, now that I hope you have a clearer understanding of what 
I'm doing here.

Using ruby 1.8.6 or ironruby v0.3, running this file through command line 
[ruby/ir] my_test.rb doesn't choke:

raise "detected!" if defined?(System::Windows::Forms::Control)

Putting the same code as the first line of app.rb in a silverlight ironruby app 
fails:

MemberAccessException: uninitialized constant System::Windows::Forms

Is there any way to retrieve some accurate info on versioning from inside 
silverlight, so that I can make a better report or understand what's happening ?

-- Thibaut
_______________________________________________
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

Reply via email to