[Mono-winforms-list] GetPositionFromCharIndex

Maser, Dan Dan.Maser at inin.com
Fri May 11 08:39:57 EDT 2007


  I don't know if this is official or not, but in practice I've had
success trapping the error when done properly.  It looks to me like mono
will crash when compiling the function if the error catch is *in* the
function, but be ok if the error trap is *outside* of the function.
Specifically:

This does NOT work:

void foo()
{
  try
  {
     System.MethodThatMonoIsMissing();	// This will blow up mono
  }
  catch (System.MissingMethodException)
  {
  }
}


This DOES work:

void foo()
{
  try
  {
     bar();			// The MissingMethodException will be
thrown when 'bar()' is compiled, but be caught here ok.
  }
  catch (System.MissingMethodException)
  {
  }
}

void bar()
{
   System.MethodThatMonoIsMissing();  
}


-----Original Message-----
From: mono-winforms-list-bounces at lists.ximian.com
[mailto:mono-winforms-list-bounces at lists.ximian.com] On Behalf Of
monkeyx
Sent: Friday, May 11, 2007 4:24 AM
To: mono-winforms-list at lists.ximian.com
Subject: Re: [Mono-winforms-list] GetPositionFromCharIndex


Thanks very much for your help.MoMA helped explain why I could not error
trap
the code, as mono will crash if the method is missing.

Is there a link/howto on how one call help contribute?

Jonathan Pobst wrote:
> 
> That method has not been implemented yet.  You will either have to
code 
> around it, implement the method in Mono yourself, or wait for it to be

> implemented.
> 
> I would suggest running MoMA on your app.  It will tell you exactly 
> which methods you may be using that have not been implemented yet in 
> Mono, as this may not be the only one.
> 
> http://www.mono-project.com/MoMA
> 
> Good luck!
> Jon
> 
> 
> monkeyx wrote:
>> I am having some problems getting GetPositionFromCharIndex to work on
>> Mono
>> 1.2.3 and libgdiplus 1.2.3
>> Tested issue on Ubuntu 7.04 and Suse 10.2 using even built sources on
>> Centos
>> 5 all give same error.
>> 
>> I have shown code and crash error below, has anyone else seen this
error
>> or
>> advise me on how I can help fix it!
>> 
>>           if (e.KeyCode == Keys.OemPeriod && e.Shift == true)
>> 
>>            {
>> 
>> 
>> 
>>                index = richTextBox1.SelectionStart;
>> 
>> // This line appears to be causing crash
>> 
>>                pt = richTextBox1.GetPositionFromCharIndex(index);
>> 
>>                pt.X += richTextBox1.Location.X;
>> 
>>                pt.Y += richTextBox1.Location.Y;
>> 
>> 
>> 
>>                lstboxEdit.Location = pt;
>> 
>> 
>> 
>>                lstboxEdit.Visible = true;
>> 
>>            }
>> 
>> This is summary of crash error
>> ** (lpOED.exe:6904): WARNING **: Missing method
>> System.Windows.Forms.TextBoxBase::GetPositionFromCharIndex(int) in
>> assembly
>>
/usr/lib/mono/gac/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.
Windows.Forms.dll,
>> referenced in assembly /media/MightyDrive/lpOED.exe
>> System.MissingMethodException: Method not found:
>> 'System.Windows.Forms.TextBoxBase.GetPositionFromCharIndex'.
>>   at <0x00000> <unknown method>
> 
> _______________________________________________
> Mono-winforms-list maillist  -  Mono-winforms-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-winforms-list
> 
> 

-- 
View this message in context:
http://www.nabble.com/GetPositionFromCharIndex-tf3723721.html#a10428607
Sent from the Mono - WinForms mailing list archive at Nabble.com.

_______________________________________________
Mono-winforms-list maillist  -  Mono-winforms-list at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list




More information about the Mono-winforms-list mailing list