Posts: 1,031
Threads: 246
Joined: Jul 2022
03-08-2024, 10:09 PM
(This post was last modified: 03-08-2024, 10:15 PM by Davider.)
I often encounter the following exception when copying some code to the code editing area of LA. There may be some problems with the copied code, and the code can be modified after LA restarts
https://i.ibb.co/6sFw7y7/A.gif
Additional:
The issue occurs when formatting the code, and now I cannot use the format button. Whenever I use it, LA crashes. Strangely, the script can still execute normally.
Posts: 12,073
Threads: 140
Joined: Dec 2002
How to pause these animated gifs?
Posts: 1,031
Threads: 246
Joined: Jul 2022
03-09-2024, 08:23 AM
(This post was last modified: 03-09-2024, 08:26 AM by Davider.)
I don't know either.
The error message is very long and can't be copied.
OCR
Exception
ArgumentOutOfRangeException, repeatCount (-1) must be a non-negative value. (Parameter
'repeatCount')
Actual value was -1.
System.ArgumentOutOfRangeException: repeatCount (-1) must be a non-negative value. (Parameter
'repeatCount')
Actual value was -1.
at System.ArgumentOutOfRangeException.ThrowNegative[T](T value, String paramName)
at System.ArgumentOutOfRangeException.ThrowlfNegative[T(T value, String paramName)
at System.Text.StringBuilder .Append(Char value, Int32 repeatCount)
at Microsof.CodeAnalysis.ormatting.FormattingExtensions.AppendIndentationString(StringBuilder sb,
Int32 desiredIndentation, Boolean useTab, Int32 tabSize) in
C:\Downloads\osyn-main\src\Workspaces\SharediUilitiesAndExtensions\CompilerCOoreFpratin.-line
130
at Microsoft.CodeAnalysis.Formatting.AbstractTriviaFormatter.GetWhitespaceString(LineColumn
lineColumn, LineColumnDelta delta) in
C:\Downloads\roslyn-main\src\Workspaces\SharedUilitiesAndExtensions\CompilertorFomain..line
814
at Microsof.CodeAnalysis.Formatting.AbstractTriviaFormatter .AddWhitespaceTextChange(LineColumn
lineColumn, LineColumnDelta delta, TextSpan span, ArrayBuilder'1 changes) in
C:\Downloads\roslyn-main\src\Workspaces\SharedUtlitiesAndExtensions\CompilerCoreF>omamin...line
828
a
Microsoft.CodeAnalysis.Formatting.AbstractTriviaFormatter.FormatFirstTriviaAndWhitespaceAtfer[T(ineC...
lineColumnBeforeTrivia1, SyntaxTrivia trivia1, LineColumnDelta existingWhitespaceBetween, SyntaxTrivia
trivia2, Formatter 1 format, WhitespaceAppender 1 addWhitespace Trivia, ArrayBuilder 1 changes, Boolean
implcitLineBreak, CancellationToken cancellationToken) in
C:\Downloads\roslyn-main\src\Workspaces\SharedUilitiesAndExtensions\CompilertorFomain..line
389
at Microsof.CodeAnalysis.Formatting.AbstractTriviaFormatter .FormatTrivia[T](Formatter 1 formatter,
WhitespaceAppender 1 whitespaceAdder, ArrayBuilder1 changes, CancellationToken cancellationToken) in
C:\Downloads\roslyn-main\src\Workspaces\ShareitiltiesAndExtensions\Compilr(Corematin..line
340
at Microsoft.CodeAnalysis.Formatting.AbstractTriviaFormatter.FormatToTextChanges(CancellationToken
cancellationToken) in
C:\Downloads\roslyn-main\src\Workspaces\SharedUtltiesAndExensions\CompilerCtCreFormatit..line
270
at
Microsof.CodeAnalysis.CSharp.Formatting.TriviaDataFactory.FormattedComplexTiva..ctor(FormattingCo...
context, ChainedFormattingRules formattingRules, SyntaxToken token1, SyntaxToken token2, Int32
lineBreaks, Int32 spaces, String originalString, CancellationToken cancellationToken) in
C:\Downloads\roslyn-main\src\Workspaces\SharedtltiesAndExtensions\Compiler\CSharp\Fmt...line
40
at Microsof.CodeAnalysis.CSharp.Formating.TriviaDataFactory.ComplexTrivia.Format(FormattingContext
context, ChainedFormattingRules formattingRules, Int32 lines, Int32 spaces, CancellationToken
cancellationToken) in
C:\Downloads\roslyn-main\src\Workspaces\SharedtlitiesAndExtensions\Compiler\CSharp>ma....lie
44
at
Microsof.CodeAnalysis.Formatting.AbstractTriviaDataFactory.AbstractComplexTrivia.WithIndentation(Int32
indentation, FormattingContext context, ChainedFormattingRules formattingRules, CancellationToken
cancellationToken) in
C:\Downloads\roslyn-main\src\Workspaces\SharedUtltiesAndExtensions\CompilerCtCreFormatit..lie
146
at
Microsoft.CodeAnalysis.Formatting.AbstractFormatEngine.OperationApplier .ApplyPreserveLinesOperation..
operation, Int32 pairlndex, CancellationToken cancellationToken) in
C:\Downloads\oslyn-main\src\Workspaces\SharedUlitiesAndExtensins\CompilerCOorelFatin.line
211
at
Microsoft.CodeAnalysis.Formatting.AbstractFormatEngine.OperationApplier. Apply(AdjustNewLinesOperati..
operation, Int32 pairIndex, CancellationToken cancellationToken) in
C:\Downloads\rosyn-main\src\Workspaces\SharediUilitiesAndExtensions\CompilerCOoreFpratin.-line
140
Microsoft.CodeAnalysis.Formatting.AbstractFormatEngine.ApplySpaceAndWrappingOperationsBody(or..
context, TokenPairWithOperations operation, OperationApplier applier, CancellationToken
cancellationToken) in
C:\Downloads\osyn-main\src\Workspaces\SharediUilitiesAndExtensions\CompilerCOoreFpratin.-line
421
Microsoft.CodeAnalysis.Formatting.AbstractFormatEngine.ApplySpaceAndWrappingOperations(Formattin...
context, SegmentedList 1 tokenOperations, OperationApplier applier, CancellationToken
cancellationToken) in
C:\Downloads\osyn-main\src\Workspaces\SharediUilitiesAndExtensions\CompilerCOoreFpratin.-line
390
at Microsof.CodeAnalysis.Formatting.AbstractFormatEngine.ApplyTokenOperations(FormattingContext
context, NodeOperations nodeOperations, SegmentedList 1 tokenOperations, CancellationToken :
cancellationToken) in
C:\Downloads\roslyn-main\src\Workspaces\ShareitiltiesAndExtensions\Compilr(Corematin..line
203
at Microsoft.CodeAnalysis.Formatting.AbstractFormatEngine.Format(CancellationToken
cancellationToken) in
C:\Downloads\osyn-main\src\Workspaces\SharediUilitiesAndExtensions\CompilerCOoreFpratin.-line
111
at Microsoft.CodeAnalysis.CSharp.Formatting.CSharpSyntaxFormatting.Format(SyntaxNode node,
SyntaxFormattingOptions options, IEnumerable* 1 formatingRules, SyntaxToken startToken, SyntaxToken
endToken, CancellationToken cancellationToken) in
C:\Downloads\oslyn-main\src\Workspaces\SharedilitiesAndExtensions\CompilerSharpFora.i.line
49
at Microsoft.CodeAnalysis.Formatting.AbstractSyntaxFormatting.GetFormattingResult(SyntaxNode node,
IEnumerable" 1 spans, SyntaxFormattingOptions options, IEnumerable 1 rules, CancellationToken
cancellationToken) in
C:\Downloads\roslyn-main\src\Workspaces\ShareitiltiesAndExtensions\Compilr(Corematin..line
69
at Microsof.CodeAnalysis.Formatting.Formatter.GetFormattedTextChanges(SyntaxNode node,
lEnumerable^ 1 spans, SolutionServices services, SyntaxFormattingOptions options, lEnumerable 1 rules,
CancellationToken cancellationToken) in
C:\Downloads\roslyn-main\src\Workspaces\Core\Portable\Formatting\Formatter.cs:line 315
at Microsoft.CodeAnalysis.Formatting.Formatter.GetFormattedTextChanges(SyntaxNode node, TextSpan
span, SolutionServices services, SyntaxFormattingOptions options, CancellationToken cancellationToken) in
C:\Downloads\roslyn-main\src\Workspaces\Core\Portable\Formatting\Formatter.cs:line 288
at ModifyCode.Format(Context cd, Int32& from, Int32& to)
at ModifyCode.Format(Boolean selection)
at Menus.Edit.Document.Format_ document(
at Au.Controls.MenuCommands.Command.Execute(Object parameter)
at Svstem.Wind ows.Controls. Button.OnClick0
at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.EventRoute.InvokeHandlerslmpl(Object source, RoutedEventArgs args, Boolean
reRaised)
at System.Windows.UlElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args,
RoutedEvent newEvent)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.EventRoute.InvokeHandlerslmpl(Object source, RoutedEventArgs args, Boolean
reRaised)
at System.Windows.UlElement.RaiseEventlmpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UlElement.RaiseTrustedEvent(RoutedEventArgs args)
at System.Windows.Input.InputManager.ProcessStagingArea0
at System.Windows.Input.InputProviderSite.Reportlnput(InputReport inputReport)
at System.Windows.Interop.HwndMouseInputProvider Reportlnput(IntPtr hwnd, InputMode mode, Int32
timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
at System.Windows.Interop.HwndMouselnputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg,
IntPtr wParam, IntPtr IParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr |Param, Boolean&
handled)
at System.Windows.Threading.ExceptionWrapper.InternalRealal(Delegate callback, Object args, Int32
numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback,
Object args, Int32 numArgs, Delegate catchHandler)
Posts: 12,073
Threads: 140
Joined: Dec 2002
Thank you.
This info could help to reproduce and fix this bug:
Script text.
----
Text of standard message boxes can be copied with Ctrl+C.
Posts: 1,031
Threads: 246
Joined: Jul 2022
03-09-2024, 11:21 AM
(This post was last modified: 03-09-2024, 11:25 AM by Davider.)
Ctrl+C The copied text is incomplete.
[Window Title]
LibreAutomate message
[Main Instruction]
Exception
[Content]
ArgumentOutOfRangeException, repeatCount ('-1') must be a non-negative value. (Parameter 'repeatCount')
Actual value was -1.
[Expanded Information]
System.ArgumentOutOfRangeException: repeatCount ('-1') must be a non-negative value. (Parameter 'repeatCount')
Actual value was -1.
at System.ArgumentOutOfRangeException.ThrowNegative[T](T value, String paramName)
at System.ArgumentOutOfRangeException.ThrowIfNegative[T](T value, String paramName)
at Microsoft.CodeAnalysis.Formatting.AbstractTriviaFormatter.GetWhitespaceString(LineColumn lineColumn, LineColumnDelta delta) in C:\Downloads\roslyn-main\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs:line 798
at Microsoft.CodeAnalysis.Formatting.AbstractTriviaFormatter.FormatFirstTriviaAndWhitespaceAfter[T](LineColumn lineColumnBeforeTrivia1, SyntaxTrivia trivia1, LineColumnDelta existingWhitespaceBetween, SyntaxTrivia trivia2, Formatter`1 format, WhitespaceAppender`1 addWhitespaceTrivia, ArrayBuilder`1 changes, Boolean implicitLineBreak, CancellationToken cancellationToken) in C:\Downloads\roslyn-main\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs:line 389
at Microsoft.CodeAnalysis.Formatting.AbstractTriviaFormatter.FormatTrivia[T](Formatter`1 formatter, WhitespaceAppender`1 whitespaceAdder, ArrayBuilder`1 changes, CancellationToken cancellationToken) in C:\Downloads\roslyn-main\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs:line 340
at Microsoft.CodeAnalysis.Formatting.AbstractTriviaFormatter.FormatToTextChanges(CancellationToken cancellationToken) in C:\Downloads\roslyn-main\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs:line 270
at Microsoft.CodeAnalysis.CSharp.Formatting.TriviaDataFactory.FormattedComplexTrivia..ctor(FormattingContext context, ChainedFormattingRules formattingRules, SyntaxToken token1, SyntaxToken token2, Int32 lineBreaks, Int32 spaces, String originalString, CancellationToken cancellationToken) in C:\Downloads\roslyn-main\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.FormattedComplexTrivia.cs:line 40
at Microsoft.CodeAnalysis.CSharp.Formatting.TriviaDataFactory.ComplexTrivia.Format(FormattingContext context, ChainedFormattingRules formattingRules, Int32 lines, Int32 spaces, CancellationToken cancellationToken) in C:\Downloads\roslyn-main\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.ComplexTrivia.cs:line 44
at Microsoft.CodeAnalysis.Formatting.AbstractTriviaDataFactory.AbstractComplexTrivia.WithIndentation(Int32 indentation, FormattingContext context, ChainedFormattingRules formattingRules, CancellationToken cancellationToken) in C:\Downloads\roslyn-main\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.AbstractComplexTrivia.cs:line 146
at Microsoft.CodeAnalysis.Formatting.AbstractFormatEngine.OperationApplier.Apply(AdjustNewLinesOperation operation, Int32 pairIndex, CancellationToken cancellationToken) in C:\Downloads\roslyn-main\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.OperationApplier.cs:line 140
at Microsoft.CodeAnalysis.Formatting.AbstractFormatEngine.ApplySpaceAndWrappingOperationsBody(FormattingContext context, TokenPairWithOperations operation, OperationApplier applier, CancellationToken cancellationToken) in C:\Downloads\roslyn-main\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs:line 415
at Microsoft.CodeAnalysis.Formatting.AbstractFormatEngine.ApplySpaceAndWrappingOperations(FormattingContext context, SegmentedList`1 tokenOperations, OperationApplier applier, CancellationToken cancellationToken) in
The script can execute successfully, but the format code button cannot be clicked. If the button is clicked, LA will crash.
Posts: 12,073
Threads: 140
Joined: Dec 2002
Please post the script, if possible.
Posts: 1,031
Threads: 246
Joined: Jul 2022
03-09-2024, 01:08 PM
(This post was last modified: 03-09-2024, 01:12 PM by Davider.)
It has been sent via email
Also, the icon for the script still cannot be displayed. If possible, could you connect to my computer via TeamViewer?
Posts: 12,073
Threads: 140
Joined: Dec 2002
The script in email helped to reproduce and fix it.
Cannot fix such bugs on another computer. Need Visual Studio, sources, SDKs, etc.
Posts: 1,031
Threads: 246
Joined: Jul 2022
My computer does not have VS installed.
Posts: 12,073
Threads: 140
Joined: Dec 2002
Posts: 1,031
Threads: 246
Joined: Jul 2022
Thank you, the issue has been resolved.
Additionally, sometimes multiline comments(/* ... */) cannot be used.
https://i.ibb.co/mqQgC57/A.gif
Posts: 12,073
Threads: 140
Joined: Dec 2002
03-11-2024, 05:13 AM
(This post was last modified: 03-11-2024, 05:18 AM by Gintaras.)
LA adds // when the selected code is one or more full lines and the selection ends at a line start. Else adds /* */.
|