Title Back Colour Keyoti Title Line Title Curve
Blue Box Top

System.ArgumentOutOfRangeException - RapidSpell Desktop .NET - Forum

Welcome Guest Search | Active Topics | Log In | Register

Options
WeK
#1 Posted : Wednesday, May 5, 2021 4:20:17 PM
Rank: Member

Groups: Registered

Joined: 12/18/2017
Posts: 12
Hi,
with Keyoti.RapidSpell Desktop.NET (Keyoti.RapidSpell.NET4.dll 6.0.17.1124 )
we get the following Exception, if there is a table in the RTF-Text (using RichTextBox -Control) :

************** Ausnahmetext **************
System.ArgumentOutOfRangeException: Das angegebene Argument liegt außerhalb des gültigen Wertebereichs.
Parametername: Following(622) offset out of bounds
bei Keyoti.RapidSpell.FrameWorkSpecific.SimpleTextBoundary.CheckLegalOffset(Int32 offset, String message, Boolean allowEnd)
bei Keyoti.RapidSpell.FrameWorkSpecific.SimpleTextBoundary.Following(Int32 offset)
bei Keyoti.RapidSpell.FrameWorkSpecific.AdvancedTextBoundary.Following(Int32 offset)
bei Keyoti.RapidSpell.RapidSpellAsYouTypeAgent.a(Int32 A_0, Boolean A_1)
bei Keyoti.RapidSpell.RapidSpellAsYouTypeAgent.a(Int32[] A_0, SimpleTextBoundary A_1, Boolean A_2, Int32 A_3)
bei Keyoti.RapidSpell.RapidSpellAsYouTypeAgent.a(Boolean A_0, TextChangeHint A_1)
bei Keyoti.RapidSpell.RapidSpellAsYouTypeAgent.OnTextChanged(Object sender, EventArgs e)
bei Keyoti.RapidSpell.TextBoxUtilityAdapter.g(Object A_0, EventArgs A_1)
bei Keyoti.RapidSpell.TextBoxUtilityAdapter.OnTextChanged(Object sender, EventArgs evntargs)
bei Keyoti.RapidSpell.TextBoxBaseIAYTAdapter.c(Object A_0, EventArgs A_1)
bei System.Windows.Forms.Control.OnTextChanged(EventArgs e)
bei System.Windows.Forms.TextBoxBase.OnTextChanged(EventArgs e)
bei System.Windows.Forms.TextBoxBase.WmReflectCommand(Message& m)
bei System.Windows.Forms.TextBoxBase.WndProc(Message& m)
bei System.Windows.Forms.RichTextBox.WmReflectCommand(Message& m)
bei System.Windows.Forms.RichTextBox.WndProc(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
bei System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Is this a bug ?
Or are we doing something wrong ?

Jim
#2 Posted : Wednesday, May 5, 2021 5:04:32 PM
Rank: Advanced Member

Groups: Administrators, Registered

Joined: 8/13/2004
Posts: 2,627
Location: Canada
Is your application running under .NET 4.8? We just got a similar report and it was related specifically to the .NET Framework version being used (ok in 4.5, broken in 4.8).

Can you share a document that causes the exception? I tried but couldn't reproduce.

Thanks
Jim
-your feedback is helpful to other users, thank you!


WeK
#3 Posted : Thursday, May 6, 2021 6:17:50 AM
Rank: Member

Groups: Registered

Joined: 12/18/2017
Posts: 12
Hi,
our application ist configured to use .NET 4.7.2, but when reproducing the problem i saw that it seems to use 4.8
************* Geladene Assemblys **************
mscorlib
Assembly-Version: 4.0.0.0.
Win32-Version: 4.8.4084.0 built by: NET48REL1.
CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll.


The following RTF-Sourcecode caused the problem:

{\rtf1\ansi\ansicpg1252\uc1\deff0\adeff0\deflang0\deflangfe0\adeflang0{\fonttbl
{\f0\fswiss\fcharset0\fprq2{\*\panose 020B0604020202020204}Arial;}
{\f1\froman\fcharset2\fprq2{\*\panose 05050102010706020507}Symbol;}}
{\colortbl;\red0\green0\blue0;}
{\stylesheet{\s0\ltrpar\itap0\nowidctlpar\ql\li0\ri0\lin0\rin0\cbpat0\rtlch\af0\afs24\ltrch\f0\fs24 [Normal];}{\*\cs10\additive Default Paragraph Font;}}
{\info
{\*\txInfo{\txVer 28.0.752.500}}}
\paperw11909\paperh16834\margl1138\margt1138\margr1138\margb1138\deftab1134\widowctrl\trackmoves0\trackformatting1\lytexcttp\formshade\sectd
\headery567\footery567\pgwsxn11909\pghsxn16834\marglsxn1138\margtsxn1138\margrsxn1138\margbsxn1138\pgbrdropt32
{\header\pard\ltrpar\itap0\nowidctlpar\ql\li0\ri0\lin0\rin0\plain\rtlch\af0\afs20\alang1031\ltrch\f0\fs20\lang1031\langnp1031\langfe1031\langfenp1031\par}
{\footer\pard\ltrpar\itap0\nowidctlpar\ql\li0\ri0\lin0\rin0\plain\rtlch\af0\afs20\alang1031\ltrch\f0\fs20\lang1031\langnp1031\langfe1031\langfenp1031\par}\pard\ltrpar\itap0\nowidctlpar\ql\li0\ri0\lin0\rin0\plain\rtlch\af0\afs20\alang1031\ltrch\f0\fs20\lang1031\langnp1031\langfe1031\langfenp1031 Test\par\trowd\irow0\irowband0\trgaph36\trleft0\trpaddl36\trpaddr36\trpaddfl3\trpaddft3\trpaddfr3\trpaddfb3\clvertalt\clftsWidth3\clwWidth1926\cellx1926\clvertalt\clftsWidth3\clwWidth1926\cellx3852\clvertalt\clftsWidth3\clwWidth1926\cellx5778\clvertalt\clftsWidth3\clwWidth1926\cellx7704\clvertalt\clftsWidth3\clwWidth1926\cellx9630\pard\ltrpar\intbl\nowidctlpar\ql\li0\ri0\lin0\rin0 Test 11\cell Test12\cell Test13\cell\cell\cell\trowd\irow0\irowband0\trgaph36\trleft0\trpaddl36\trpaddr36\trpaddfl3\trpaddft3\trpaddfr3\trpaddfb3\clvertalt\clftsWidth3\clwWidth1926\cellx1926\clvertalt\clftsWidth3\clwWidth1926\cellx3852\clvertalt\clftsWidth3\clwWidth1926\cellx5778\clvertalt\clftsWidth3\clwWidth1926\cellx7704\clvertalt\clftsWidth3\clwWidth1926\cellx9630\row\trowd\irow1\irowband1\lastrow\trgaph36\trleft0\trpaddl36\trpaddr36\trpaddfl3\trpaddft3\trpaddfr3\trpaddfb3\clvertalt\clftsWidth3\clwWidth1926\cellx1926\clvertalt\clftsWidth3\clwWidth1926\cellx3852\clvertalt\clftsWidth3\clwWidth1926\cellx5778\clvertalt\clftsWidth3\clwWidth1926\cellx7704\clvertalt\clftsWidth3\clwWidth1926\cellx9630\pard\ltrpar\intbl\nowidctlpar\ql\li0\ri0\lin0\rin0 Test 21\cell Test22\cell\cell\cell\cell\trowd\irow1\irowband1\lastrow\trgaph36\trleft0\trpaddl36\trpaddr36\trpaddfl3\trpaddft3\trpaddfr3\trpaddfb3\clvertalt\clftsWidth3\clwWidth1926\cellx1926\clvertalt\clftsWidth3\clwWidth1926\cellx3852\clvertalt\clftsWidth3\clwWidth1926\cellx5778\clvertalt\clftsWidth3\clwWidth1926\cellx7704\clvertalt\clftsWidth3\clwWidth1926\cellx9630\row\pard\ltrpar\itap0\nowidctlpar\ql\li0\ri0\lin0\rin0 }


Jim
#4 Posted : Thursday, May 6, 2021 6:27:16 PM
Rank: Advanced Member

Groups: Administrators, Registered

Joined: 8/13/2004
Posts: 2,627
Location: Canada
Apparently the change came in v4.7, when .NET started using the underlying Windows control RichEdit v5 (I believe previous versions of the framework used v2). https://stackoverflow.co...nment-issue-with-net4-8

There seem to be a raft of compatibility issues with this change https://github.com/dotnet/winforms/issues/3399 (that's .NET 5 but applies to 4.7 too since they both use the newer control).

I'm not certain that we can work around them (well, the exception you found is now fixed, it was because we expected rtb.TextLength==rtb.Text.Length which it doesn't anymore, but there are other issues with alignments that come in).

The simplest solution is to add this to your app.config

<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup>

<runtime>
<!--otherwise .NET 4.7+ uses richedit v5 which is broken-->
<AppContextSwitchOverrides value="Switch.System.Windows.Forms.DoNotLoadLatestRichEditControl=true"/>
</runtime>

</configuration>


-your feedback is helpful to other users, thank you!


WeK
#5 Posted : Friday, May 7, 2021 10:00:00 AM
Rank: Member

Groups: Registered

Joined: 12/18/2017
Posts: 12
Thanks for the information.

But our application is a C++/CLI application, not a C# Windows Forms application.
Do you know whether/how one can configure using the old RichEditcontrol in that kind of application ?
WeK
#6 Posted : Friday, May 7, 2021 12:06:12 PM
Rank: Member

Groups: Registered

Joined: 12/18/2017
Posts: 12
Hi,
I tried with an app.config file, and it also seems so work with a C++/CLI exe.
Thanks for your help.

I've not yet determined whether/what new features are availible in RichtEdit v5,
but:
Will there be a keyoti RapidSpell Desktop .NET version, which works also with the new RichEdit v5
Jim
#7 Posted : Friday, May 7, 2021 7:04:01 PM
Rank: Advanced Member

Groups: Administrators, Registered

Joined: 8/13/2004
Posts: 2,627
Location: Canada
My hope is that they (MS) will iron out the issues in .NET Framework 4.7+ and make the RichTextBox API consistent with the legacy version. The link above to the github issue shows that at least for .NET 5 they are trying to resolve these issues.

My guess is that .NET 4.x won't get it fixed, they will expect you to move to .NET 5.

Regardless of that, we're trying to assess what level impact this is for our customers. Pursuing a patchy workaround of .NET 4.7/4.8 bugs is obviously undesireable, and I'm not even sure if it is possible. The other customer that mentioned this issue was also having other issues with alignments in the new rich edit control that are not related to RapidSpell, so it is possible that downgrading is just the best solution anyway...

So, basically we will continue to assess the situation and provide what we can.

Jim
-your feedback is helpful to other users, thank you!


Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.




About | Contact | Site Map | Privacy Policy

Copyright © 2002- Keyoti Inc.