I’m trying to derive a class from a .NET class like this:
class X < System::Windows::Forms::Form
and I get this error message:
System.InvalidOperationException: superclass must be a Class
(NestedTypeTracker given)
Am I missing anything?
I’m running the latest IronRuby release.
Dermot
www.sapphiresteel.com
Deriving from CLR class is not supported yet.
Tomas
OK, thanks.
When (approximately) do you expect to support this?
Dermot
Great!
I’m a bit stuck with the Form designer until that works.
Do delegates work yet?
Dermot
Yes - delegates work.
Have you gotten success in integrating IronRuby into the VS editor yet?
Thanks,
-John
John M. from our team is looking into this issue now. Shouldn’t be
long …
-John
The VS editor supports Ruby - it doesn’t care which flavor it is. I can
edit and launch IronRuby from the editor just like I can with JRuby or
classic Ruby.
I can also generate IronRuby code from the Form Designer and generate a
Form layout back from the Ruby code. What I can’t do is run the
generated IronRuby like you would VB or C# … that’s why I need the
Windows inheritance in IronRuby. The VS Form Designer is very picky and
works in a very specific way. You really have to do exactly what it
expects you to do. I’ve also got to code the Form Designer merge logic.
I haven’t tried the debugger yet. The basics should be reasonably easy,
but I suspect the difficult bit will be getting the inspectors to work.
I spent a lot of time with Matz’s Ruby getting VS debug expressions (the
watch windows and debug data tips) to work correctly. The main problem
is that there is no defined syntax for the string returned by inspect -
you can return what you like - and there are at least 7 or 8 different
formats.
The bulk of the work is really stitching the whole thing together -
there’s no show stopper in there (but the Form Designer can be a real
pita). My problem is that I’m doing this in my spare time - of which I
don’t have a lot
Dermot
Dermot H.:
I can also generate IronRuby code from the Form Designer and generate a
Form layout back from the Ruby code. What I can’t do is run the
generated IronRuby like you would VB or C# … that’s why I need the
Windows inheritance in IronRuby. The VS Form Designer is very picky and
works in a very specific way. You really have to do exactly what it
expects you to do. I’ve also got to code the Form Designer merge logic.
Understood. We’ll need to get this to work.
I haven’t tried the debugger yet. The basics should be reasonably easy,
but I suspect the difficult bit will be getting the inspectors to work.
I spent a lot of time with Matz’s Ruby getting VS debug expressions
(the
watch windows and debug data tips) to work correctly. The main problem
is that there is no defined syntax for the string returned by inspect -
you can return what you like - and there are at least 7 or 8 different
formats.
I wouldn’t recommend looking at this until we’ve had a chance to rewrite
the scanner in IronRuby. Right now the one that we’re using doesn’t
report line / column positions correctly. Once that works, we’ll be able
to emit the correct PDBs, which should enable the VS debugger to “just
work”.
Thanks for working on this!
-John
Hi John,
Here’s some very simple text: a form, a checkbox and a button with a
couple of attributes. I haven’t been able run this in IR at all so I’ve
no idea if it will work or not. However, it looks like the sort of thing
that the Form Designer produces in C# or VB. Tt does ‘round trip’
between the designer and persistant store, so it’s internally consistent
- I think
require ‘mscorlib’
require ‘System’
require ‘System.Windows.Forms’
require ‘System.Drawing’
class Form1123 < System::Windows::Forms::Form
attr_accessor :checkBox1
attr_accessor :button2
def InitializeComponent
self.button2 = System::Windows::Forms::Button.new()
self.checkBox1 = System::Windows::Forms::CheckBox.new()
self.SuspendLayout()
#
# button2
#
self.button2.Location = System::Drawing::Point.new(79, 113)
self.button2.Name = "button2"
self.button2.Size = System::Drawing::Size.new(75, 23)
self.button2.TabIndex = 0
self.button2.Text = "button2"
self.button2.TextAlign = System::Drawing::ContentAlignment.TopCenter
self.button2.UseVisualStyleBackColor = true
#
# checkBox1
#
self.checkBox1.Anchor = System::Windows::Forms::AnchorStyles.Top |
System::Windows::Forms::AnchorStyles.Bottom |
System::Windows::Forms::AnchorStyles.Left
self.checkBox1.AutoSize = true
self.checkBox1.Location = System::Drawing::Point.new(79, 61)
self.checkBox1.Name = “checkBox1”
self.checkBox1.Size = System::Drawing::Size.new(90, 17)
self.checkBox1.TabIndex = 1
self.checkBox1.Text = “checkBox1”
self.checkBox1.TextAlign = System::Drawing::ContentAlignment.TopLeft
self.checkBox1.UseVisualStyleBackColor = true
#
# Form1123
#
self.ClientSize = System::Drawing::Size.new(284, 264)
self.Controls.Add(self.checkBox1)
self.Controls.Add(self.button2)
self.Name = “Form1123”
self.ResumeLayout(false)
self.PerformLayout()
end
end
good luck!
Dermot
Hi Dermot,
Do you have any sample Ruby code generated by the Windows Forms
designer? I’d like to try it out so I can see what the issues are to get
it working.
Thanks!
John
I attached a patch that fixes inheriting from a CLR base class. Of
course, there’s still a lot more work to do, but it lets you do the
basic things like inherit from a CLR type and add methods in Ruby.
A quick look at the code:
Enums are broken today, so that won’t work without some helper library
that just returns the enum value. This is on our short list of bugs to
fix already.
Jomes has already fixed inheritance and will be posting a patch for that
soon to unblock you (we’re still going to code review it internally and
run it through our testing infrastructure before it gets out).
Thanks,
-John
John L. (DLR) wrote:
I wouldn’t recommend looking at this until we’ve had a chance to rewrite the scanner in IronRuby. Right now the one that we’re using doesn’t report line / column positions correctly. Once that works, we’ll be able to emit the correct PDBs, which should enable the VS debugger to “just work”.
Will there be any effort put into making existing Ruby debugging tools
work, like debug.rb included in the Ruby stdlib and ruby-debug, the
C-based extension that allows fast debugging through a similar
interface? Most of the Java-based tools have based their debugging
capabilities on debug.rb and ruby-debug, and soon will have a
jruby-debug fast debugger to use. The JRuby compiler also enables the
possibility of using a normal Java debugger, but being mixed-mode (both
interpreted and compiled) complicates that somewhat.
Is the current effort to only support PDB-style debugging?
(FYI, you may want to look at the debug-commons project on RubyForge,
it’s a community effort between some Eclipse guys and some NetBeans guys
to build a common framework for debugging Ruby in those tools).
Is this going to be included in SVN anytime soon?
-Eric
thanks - that seems fine!
Dermot
Eric N.:
Is this going to be included in SVN anytime soon?
Yes - we have a few additional changes queued up today, but it should be
in soon!
Thanks,
-John