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: 20
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,669
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: 20
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,669
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: 20
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: 20
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,669
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!


WeK
#8 Posted : Monday, October 25, 2021 10:11:12 AM
Rank: Member

Groups: Registered

Joined: 12/18/2017
Posts: 20
Hi Jim,

has there been any progress with that problem in the last months ?
Jim
#9 Posted : Monday, October 25, 2021 6:13:58 PM
Rank: Advanced Member

Groups: Administrators, Registered

Joined: 8/13/2004
Posts: 2,669
Location: Canada
I went to bat for you with MS, see https://developercommuni...has-bug-in-GetP/1418640

All I can suggest is you voting for that and commenting, as that gets their attention.

Beyond that there is literally nothing we can do as it is a bug in the .NET Framework, sorry.

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


WeK
#10 Posted : Monday, November 15, 2021 2:39:41 PM
Rank: Member

Groups: Registered

Joined: 12/18/2017
Posts: 20
In the last weeks we did some further investigation, with the following results:
1.
Switching back to the older control version is no good solution, because graphics rendering seems to be much better with the newer control
2.
We tried to catch the exceptions thrown by Keyoti when tables are used in the RTF text, but we were unable to avoid crashes this way.
3.
It seems unlikely that MS will fix the problem.
So at present users have to choose between:
- using old control with bad graphics rendering
- generally switching off spell checking in our application
- avoiding usage of tables in RTF

To avoid those general restrictions I have another question:

Do you see a possibility that you (Keyoti) would catch such exceptions in your source so that crashes are avoided if tables are present ?
(It would be no problem, if spell checking would not work in those special/rare cases)
Jim
#11 Posted : Monday, November 15, 2021 9:47:08 PM
Rank: Advanced Member

Groups: Administrators, Registered

Joined: 8/13/2004
Posts: 2,669
Location: Canada
Ok, would you like to try this build then, it will handle those circumstances better, it's probable that the underlines will look misplaced (under the wrong words).

https://www.dropbox.com/t/tBx8Ve9Dc4wrU7Lq
-your feedback is helpful to other users, thank you!


WeK
#12 Posted : Friday, December 10, 2021 12:44:58 PM
Rank: Member

Groups: Registered

Joined: 12/18/2017
Posts: 20
Sorry for the long delay; this was because of the following problems:

We tried this DLL, but our app crashed when using it with a System.IO.FileLoadException.

I guess that this is because currently we use v6.0, but the new dll is v6.2;
so we have to update our application to v6.2

We downloaded v6.2, but we found no new license for v6.2, therefore:
Will v6.2 work with the 6.0 license ? Or do we need a new license for v6.2 ?
Jim
#13 Posted : Friday, December 10, 2021 9:20:19 PM
Rank: Advanced Member

Groups: Administrators, Registered

Joined: 8/13/2004
Posts: 2,669
Location: Canada
Did it say what file it couldn't load?

You don't need to get a new license, any 6.x license works.
-your feedback is helpful to other users, thank you!


Jim
#14 Posted : Friday, December 10, 2021 9:21:06 PM
Rank: Advanced Member

Groups: Administrators, Registered

Joined: 8/13/2004
Posts: 2,669
Location: Canada
Btw I am about to post the TX30 support DLL, you can just skip to using that if you like, don't bother with the 6.2 MSI or the link above
-your feedback is helpful to other users, thank you!


WeK
#15 Posted : Monday, December 13, 2021 3:22:22 PM
Rank: Member

Groups: Registered

Joined: 12/18/2017
Posts: 20
Thanks for your reply.

Unfortunatelly no filename was given in the System.IO.FileLoadException.

BTW:
The above problem occurs when using Keyoti.RapidSpell.NET4.DLL in a .NET-RichTextBox
(it has not been reported to us that it also occurs when using Keyoti.RapidSpell.NET4.TXSupportvXX.dll in a TXTextControl)
We are using Keyoti in both control types.

Will Keyoti.RapidSpell.NET4.TXSupportv30.dll contain the whole functionality itself, or will it need/use a Keyoti.RapidSpell.NET4.DLL ?
And if the former: Will Keyoti.RapidSpell.NET4.TXSupportv30.dll also contain the changes from 15.11.2021 ?
Jim
#16 Posted : Monday, December 13, 2021 6:59:55 PM
Rank: Advanced Member

Groups: Administrators, Registered

Joined: 8/13/2004
Posts: 2,669
Location: Canada
Yes Keyoti.RapidSpell.NET4.TXSupportv30.dll has everything that Keyoti.RapidSpell.NET4.DLL does - and all changes to date. So if you can use that without the exception please go ahead.

Otherwise, if you can send the stack trace that would help, and is it doing it to every user?

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


WeK
#17 Posted : Thursday, December 16, 2021 10:48:33 AM
Rank: Member

Groups: Registered

Joined: 12/18/2017
Posts: 20
Thanks for your reply.

We updated our application to Keyoti 6.2 now and now the System.IO.FileLoadException has gone and the behaviour regarding tables in RTF text is now better then before, but the following problem remains :

If the newest MS-RTF-Control is used
AND there is a table in the RTF-text
AND there are misspelled words in the RTF-Table
then our application crashes/hangs, when the Keyoti spelltest is called via kontext-menuitem of the RTF-Control
(but no Windows event log entry is created)

Do you see a possibility to handle this crash in Keyoti ?
Jim
#18 Posted : Thursday, December 16, 2021 4:49:32 PM
Rank: Advanced Member

Groups: Administrators, Registered

Joined: 8/13/2004
Posts: 2,669
Location: Canada
Are you able to find the exception and stack trace? Perhaps use your debugger with capturing all first chance exceptions and seeing which one is related to the crash?

You will of course get the ones that are handled, such as the original ArgumentOutOfRangeException, but keep going until you find what isn't handled please.
-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.