Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start Position must lie inside rance #1031

Open
TechnVision opened this issue Dec 22, 2023 · 1 comment
Open

Start Position must lie inside rance #1031

TechnVision opened this issue Dec 22, 2023 · 1 comment

Comments

@TechnVision
Copy link

Environment

  • Visual Studio version: 2022 Community
  • CodeMaid version: 12.0
  • Code language: C#

Here is the stack trance that I get in output window, but not so sure why this happens, my project builds and works fine but some sort of error is thrown here.

[CodeMaid Handled Exception 12:00:04 AM] CodeMaid Cleanup for 'FrmCreateNewCompany.cs' was stopped: System.ArgumentException: startingPosition (132497) must lie inside searchRange ([0..132496))
Parameter name: startingPosition
at Microsoft.VisualStudio.Text.Find.Implementation.BaseFinderForSnapshot.AdjustSearchRange(Int32 startingPosition, Span searchRange)
at Microsoft.VisualStudio.Text.Find.Implementation.BaseFinderForSnapshot.TryFind(Int32 startingPosition, Span searchRange, Span& result)
at Microsoft.VisualStudio.Text.Find.Implementation.BaseFinderForSnapshot.TryFind(Int32 startingPosition, Span& result)
at SteveCadwallader.CodeMaid.Helpers.TextDocumentHelper.<>c__DisplayClass4_0.b__0() in C:\projects\codemaid\CodeMaidShared\Helpers\TextDocumentHelper.cs:line 130
at SteveCadwallader.CodeMaid.Helpers.TextDocumentHelper.<>c__DisplayClass20_0.<b__0>d.MoveNext() in C:\projects\codemaid\CodeMaidShared\Helpers\TextDocumentHelper.cs:line 448
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Threading.JoinableTask.CompleteOnCurrentThread()
at SteveCadwallader.CodeMaid.Helpers.TextDocumentHelper.RunOnUIThread(Action action) in C:\projects\codemaid\CodeMaidShared\Helpers\TextDocumentHelper.cs:line 450
at SteveCadwallader.CodeMaid.Helpers.TextDocumentHelper.TryFindNextMatch(EditPoint startPoint, EditPoint& endPoint, String patternString) in C:\projects\codemaid\CodeMaidShared\Helpers\TextDocumentHelper.cs:line 144
at SteveCadwallader.CodeMaid.Logic.Cleaning.UpdateLogic.UpdateEndRegionDirectives(TextDocument textDocument) in C:\projects\codemaid\CodeMaidShared\Logic\Cleaning\UpdateLogic.cs:line 72
at SteveCadwallader.CodeMaid.Logic.Cleaning.CodeCleanupManager.RunCodeCleanupCSharp(Document document) in C:\projects\codemaid\CodeMaidShared\Logic\Cleaning\CodeCleanupManager.cs:line 335
at SteveCadwallader.CodeMaid.Logic.Cleaning.CodeCleanupManager.<>c__DisplayClass19_0.b__0() in C:\projects\codemaid\CodeMaidShared\Logic\Cleaning\CodeCleanupManager.cs:line 170
at SteveCadwallader.CodeMaid.Helpers.UndoTransactionHelper.Run(Action tryAction, Action`1 catchAction) in C:\projects\codemaid\CodeMaidShared\Helpers\UndoTransactionHelper.cs:line 55

@asdfchlwnsgy1236
Copy link

I have exactly the same issue.
From my testing, it happens for certain when the entire file is surrounded with #if/#endif.
Not sure about other preprocessor macros, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants