SyntaxEditor for WPF Web Languages Add-on Crash on code typing

SyntaxEditor Web Languages Add-on for WPF Forum

Posted 10 years ago by Karlen Simonyan
Version: 13.2.0591
Platform: .NET 4.5
Environment: Windows 8 (64-bit)
Avatar

Hi, Actipro Team!

There is bug in SyntaxEditor JavaScript language addon.

While typing code using new blank document, editor just crashes - but only with following condition:

1) type 'function'

2) then function name

3) type Enter-command, while typing '{' bracket

--

Regards,

Karlen

Comments (14)

Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Karlen,

Sorry I'm trying but I'm not getting any crashes.  Can you explain how to make it happen in a bit more detail and provide all the exception info (message, stack trace, etc.)?


Actipro Software Support

Posted 10 years ago by Karlen Simonyan
Avatar

Here is my XAML for window:

<Window
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:syntaxeditor="http://schemas.actiprosoftware.com/winfx/xaml/syntaxeditor" x:Class="WpfApplication1.MainWindow"
        Title="MainWindow" Height="350" Width="525">
    <Grid>

        <syntaxeditor:SyntaxEditor HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
            <syntaxeditor:EditorDocument>
                <syntaxeditor:EditorDocument.Language>
                    <syntaxeditor:JavaScriptSyntaxLanguage/>
                </syntaxeditor:EditorDocument.Language>
            </syntaxeditor:EditorDocument>
        </syntaxeditor:SyntaxEditor>

    </Grid>
</Window>

 Code-behind file:

namespace WpfApplication1
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }
    }
}

Exception type: ArgumentOutOfRangeException

ParamName: offset

Source: ActiproSoftware.Text.Wpf

StackTrace:

   в #PZc.#VZc.#29c(Int32 #fd)
   в #Q2b.#zZc..ctor(#OZc textData, Int32 startOffset, String deletedText, String insertedText, Boolean isTextReplacement, Boolean isProgrammaticTextReplacement, Boolean isIgnoredForTranslation)
   в ActiproSoftware.Text.Implementation.TextDocumentBase.#O7c(#g7b #g7b)
   в #Q2b.#g7b.Apply()
   в ActiproSoftware.Text.Implementation.TextDocumentBase.ReplaceText(ITextChangeType type, Int32 offset, Int32 length, String text, ITextChangeOptions options)
   в ActiproSoftware.Text.Implementation.TextDocumentBase.InsertText(ITextChangeType type, Int32 offset, String text, ITextChangeOptions options)
   в ActiproSoftware.Text.Analysis.Implementation.DelimiterAutoCompleter.#4Ch(TextSnapshotOffset #uxf, Char #YJf)
   в ActiproSoftware.Text.Analysis.Implementation.DelimiterAutoCompleter.OnDocumentTextChanged(SyntaxEditor editor, EditorSnapshotChangedEventArgs e)
   в ActiproSoftware.Text.Analysis.Implementation.DelimiterAutoCompleter.#B1b(SyntaxEditor #qxf, EditorSnapshotChangedEventArgs #yhb)
   в ActiproSoftware.Windows.Controls.SyntaxEditor.SyntaxEditor.RaiseDocumentTextChangedEvent(ITextSnapshot oldSnapshot, ITextSnapshot newSnapshot, ITextChange textChange)
   в ActiproSoftware.Windows.Controls.SyntaxEditor.SyntaxEditor.OnDocumentTextChanged(Object sender, TextSnapshotChangedEventArgs e)
   в ActiproSoftware.Text.Implementation.TextDocumentBase.OnTextChanged(TextSnapshotChangedEventArgs e)
   в ActiproSoftware.Text.Implementation.CodeDocument.OnTextChanged(TextSnapshotChangedEventArgs e)
   в ActiproSoftware.Text.Implementation.TextDocumentBase.#O7c(#g7b #g7b)
   в #Q2b.#g7b.Apply()
   в ActiproSoftware.Windows.Controls.SyntaxEditor.Primitives.EditorView.BasicReplaceSelectedText(ITextChangeType type, String text, IEditorViewTextChangeOptions options)
   в ActiproSoftware.Windows.Controls.SyntaxEditor.Primitives.EditorView.ReplaceSelectedText(ITextChangeType type, String text, IEditorViewTextChangeOptions options)
   в ActiproSoftware.Windows.Controls.SyntaxEditor.EditActions.TypingAction.Execute(IEditorView view)
   в ActiproSoftware.Windows.Controls.SyntaxEditor.Primitives.EditorView.ExecuteEditAction(IEditAction action)
   в ActiproSoftware.Windows.Controls.SyntaxEditor.Primitives.EditorView.ProcessOnTextInput(TextCompositionEventArgs e)
   в ActiproSoftware.Windows.Controls.SyntaxEditor.Primitives.EditorView.OnTextInput(TextCompositionEventArgs e)
   в System.Windows.UIElement.OnTextInputThunk(Object sender, TextCompositionEventArgs e)
   в System.Windows.Input.TextCompositionEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
   в System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   в System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   в System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   в System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   в System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
   в System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
   в System.Windows.Input.InputManager.ProcessStagingArea()
   в System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
   в System.Windows.Input.TextCompositionManager.UnsafeCompleteComposition(TextComposition composition)
   в System.Windows.Input.TextCompositionManager.PostProcessInput(Object sender, ProcessInputEventArgs e)
   в System.Windows.Input.InputManager.RaiseProcessInputEventHandlers(ProcessInputEventHandler postProcessInput, ProcessInputEventArgs processInputEventArgs)
   в System.Windows.Input.InputManager.ProcessStagingArea()
   в System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
   в System.Windows.Input.TextCompositionManager.UnsafeStartComposition(TextComposition composition)
   в System.Windows.Input.TextCompositionManager.PostProcessInput(Object sender, ProcessInputEventArgs e)
   в System.Windows.Input.InputManager.RaiseProcessInputEventHandlers(ProcessInputEventHandler postProcessInput, ProcessInputEventArgs processInputEventArgs)
   в System.Windows.Input.InputManager.ProcessStagingArea()
   в System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
   в System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
   в System.Windows.Interop.HwndKeyboardInputProvider.ProcessTextInputAction(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   в System.Windows.Interop.HwndSource.OnPreprocessMessage(Object param)
   в System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   в MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
   в System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   в System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)
   в System.Windows.Interop.HwndSource.OnPreprocessMessageThunk(MSG& msg, Boolean& handled)
   в System.Windows.Interop.HwndSource.WeakEventPreprocessMessage.OnPreprocessMessage(MSG& msg, Boolean& handled)
   в System.Windows.Interop.ComponentDispatcherThread.RaiseThreadMessage(MSG& msg)
   в System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   в System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   в System.Windows.Threading.Dispatcher.Run()
   в System.Windows.Application.RunDispatcher(Object ignore)
   в System.Windows.Application.RunInternal(Window window)
   в System.Windows.Application.Run(Window window)
   в System.Windows.Application.Run()
   в WpfApplication1.App.Main() в c:\Users\Karlen\AppData\Local\Temporary Projects\WpfApplication1\obj\Debug\App.g.cs:строка 0
   в System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   в System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   в Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   в System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   в System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   в System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   в System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   в System.Threading.ThreadHelper.ThreadStart()

 TargetSite: {Int32 #29c(Int32)}

Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Thanks but we need more detail on the steps to make it happen.  For instance, what are the exact contents of the editor before step 3?  And please explain more about what you mean at step 3 since I'm not clear on what is written there.


Actipro Software Support

Posted 10 years ago by Karlen Simonyan
Avatar

The content of editor is blank document.

So I start typing just example js code:

function func()

 Pressing "whitespace" key, then pressing 'Enter' key with curly bracket '{' application just crashes.

the final code without crash should be:

function func()
{

}
Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Karlen,

Sorry but I'm still not able to get any problems to show up.  It's the "then pressing 'Enter' key with curly bracket '{'" part that I am not understanding.  Do you mean you are somehow pressing them at the same time or just pressing Enter and then afterwards, '{'?  Please explain that in more detail, thanks!

Also are you sure you're on the latest version?  Which exact build are you on?


Actipro Software Support

Posted 10 years ago by Karlen Simonyan
Avatar

Hi Actipro Team!

Yes, I'am pressing at the same time Enter key with {

I've started evaluating build 0591.

Regards,

Karlen

Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Karlen,

I've been trying to repro this but still cannot.  I've tried for quite a while now and it works properly no matter how much I type the Enter and { around the same time.  I really need to be able to reproduce this reliably to be able to work on any sort of code change for it.


Actipro Software Support

Posted 10 years ago by Karlen Simonyan
Avatar

I see. So at least I may provide just my machines configurations if it could help:

Windows 7 x64 SP1 Russian Language Pack; .NET Framework 4.5; VS 2012 Update 4

Windows Server 2012 x64; .NET Framework 4.5; VS 2012 Update 3

At this time I'am evaluating SyntaxEditor and would like to use/ship with my product. But this strange bug is confusing.

--

Regards,

Karlen

Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Karlen,

There must be some step that I am doing differently from what you are doing to make this happen since it shouldn't matter what Windows version you are on (unless you are using some form of IME input).  Are you using IME input?  I'm trying to follow your instructions exactly but it's never crashed for me.

Could you possibly try to make a new simple sample project and automate it?  For instance, add a SyntaxEditor to a window and do this code in response to a button:

editor.Document.SetText("function func() ");
editor.Caret.Offset = editor.ActiveView.CurrentSnapshot.Length;
editor.ActiveView.ExecuteEditAction(new ActiproSoftware.Windows.Controls.SyntaxEditor.EditActions.TypingAction("{", false));
editor.ActiveView.TextChangeActions.InsertLineBreak();

When I do that, it's working fine.  I even tried switching the last two lines to see if it would happen but it didn't.


Actipro Software Support

Posted 10 years ago by Karlen Simonyan
Avatar

Hi, Actipro Team!

I'am not using any kind of IME input.

I've tried with your sample code provided, but there is no crash behavior.

So I've recorded a video how to reproduce this behavior - link at SkyDrive.

--

Regards,

Karlen

Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Karlen,

We still have been unable to reproduce it, even doing the same as what you do in the video.  Can you write us at our support address and reference this post?  We'd like to send you a link to a preview build of the next maintenance release to try, so you can see if you can make it happen there as well.


Actipro Software Support

Posted 10 years ago by Karlen Simonyan
Avatar

Hi, Actipro Team!

I'll write to your support address, but would like to know the way you are assuming, i.e.

1) By using https://support.actiprosoftware.com/Main/frmTickets.aspx

2) Or by support@...

--

Regards,

Karlen

[Modified 10 years ago]

Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Karlen,

Yes, either of those go to the same private ticket system.


Actipro Software Support

Answer - Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Karlen,

Thanks again for the sample.  We were able to debug it with that.  This problem is now fixed for the upcoming maintenance release.


Actipro Software Support

The latest build of this product (v24.1.2) was released 2 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.