madskristensen / Tweakster

A Visual Studio extension
Apache License 2.0
240 stars 23 forks source link

Copy/Paste broken #62

Closed rer145 closed 3 years ago

rer145 commented 3 years ago

When copying and pasting code, I occassionally get an ArgumentOutOfRangeException. Additionally, the clipboard will only partially contain what I selected to copy. Sometimes a restart of VS will fix it temporarily, but there hasn't been a pattern to the issue in terms of amount copied, etc. However, once this exception is thrown, it definitely occurs all of the time.

Below is the log entry upon copy/paste of some code. This mostly has been occurring in JS and CS files.

Version installed: 1.1.103 (installed 10/24/2020) VS 2019 Community v16.7.3 Windows 10.0.18363

<entry>
    <record>998</record>
    <time>2020/10/27 15:12:49.352</time>
    <type>Error</type>
    <source>Editor or Editor Extension</source>
    <description>System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.&#x000D;&#x000A;Parameter name: length&#x000D;&#x000A;   at Microsoft.VisualStudio.Text.Span..ctor(Int32 start, Int32 length)&#x000D;&#x000A;   at Tweakster.Tweaks.Editor.CopyWithoutIndentation.ExecuteCommand(CopyCommandArgs args, CommandExecutionContext executionContext) in C:\projects\tweakster\src\Tweaks\Editor\CopyWithoutIndentation.cs:line 85&#x000D;&#x000A;   at Microsoft.VisualStudio.UI.Text.Commanding.Implementation.EditorCommandHandlerService.&lt;&gt;c__DisplayClass14_1`1.&lt;ExecuteStartingAtIndex&gt;b__0()&#x000D;&#x000A;   at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.CallExtensionPoint(Object errorSource, Action call, Predicate`1 exceptionFilter)&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)</description>
  </entry>
Microsoft Visual Studio Community 2019
Version 16.7.3
VisualStudio.16.Release/16.7.3+30503.244
Microsoft .NET Framework
Version 4.8.03752

Installed Version: Community

Visual C++ 2019   00435-60000-00000-AA333
Microsoft Visual C++ 2019

ADL Tools Service Provider   1.0
This package contains services used by Data Lake tools

ASA Service Provider   1.0

ASP.NET and Web Tools 2019   16.7.532.28833
ASP.NET and Web Tools 2019

ASP.NET Core Razor Language Services   16.1.0.2035807+72d099b977d3a85e65fa3b0614ca8cfc803fef02
Provides languages services for ASP.NET Core Razor.

ASP.NET Web Frameworks and Tools 2012   16.7.532.28833
For additional information, visit https://www.asp.net/

ASP.NET Web Frameworks and Tools 2019   16.7.532.28833
For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0   16.7.532.28833
Azure App Service Tools v3.0.0

Azure Data Lake Node   1.0
This package contains the Data Lake integration nodes for Server Explorer.

Azure Data Lake Tools for Visual Studio   2.6.1000.1
Microsoft Azure Data Lake Tools for Visual Studio

Azure Functions and Web Jobs Tools   16.7.532.28833
Azure Functions and Web Jobs Tools

Azure Stream Analytics Tools for Visual Studio   2.6.1000.1
Microsoft Azure Stream Analytics Tools for Visual Studio

Bundler & Minifier   2.8.396
Adds support for bundling and minifying JavaScript, CSS and HTML files in any project.

C# Tools   3.7.0-6.20427.1+18ede13943b0bfae1b44ef078b2f3923159bcd32
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools   1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Cookiecutter   16.7.20248.6
Provides tools for finding, instantiating and customizing templates in cookiecutter format.

Extensibility Message Bus   1.2.6 (master@34d6af2)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

Fabric.DiagnosticEvents   1.0
Fabric Diagnostic Events

GitHub.VisualStudio   2.11.106.19330
A Visual Studio Extension that brings the GitHub Flow into Visual Studio.

Image Optimizer   4.0.132
Uses industry standard tools to optimize any JPEG, PNG and Gifs - including animated Gifs. Can do both lossy and lossless optimization.

IntelliCode Extension   1.0
IntelliCode Visual Studio Extension Detailed Info

Microsoft Azure HDInsight Azure Node   2.6.1000.1
HDInsight Node under Azure Node

Microsoft Azure Hive Query Language Service   2.6.1000.1
Language service for Hive query

Microsoft Azure Service Fabric Tools for Visual Studio   16.0
Microsoft Azure Service Fabric Tools for Visual Studio

Microsoft Azure Stream Analytics Language Service   2.6.1000.1
Language service for Azure Stream Analytics

Microsoft Azure Stream Analytics Node   1.0
Azure Stream Analytics Node under Azure Node

Microsoft Azure Tools   2.9
Microsoft Azure Tools for Microsoft Visual Studio 2019 - v2.9.30701.1

Microsoft Continuous Delivery Tools for Visual Studio   0.4
Simplifying the configuration of Azure DevOps pipelines from within the Visual Studio IDE.

Microsoft JVM Debugger   1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft Library Manager   2.1.79+ge3567815aa.RR
Install client-side libraries easily to any web project

Microsoft MI-Based Debugger   1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual C++ Wizards   1.0
Microsoft Visual C++ Wizards

Microsoft Visual Studio Tools for Containers   1.1
Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.

Microsoft Visual Studio VC Package   1.0
Microsoft Visual Studio VC Package

Mono Debugging for Visual Studio   16.7.5 (112c7bc)
Support for debugging Mono processes with Visual Studio.

Node.js Tools   1.5.20701.1 Commit Hash:b0da3724234b78593207434292d9f891440edea1
Adds support for developing and debugging Node.js apps in Visual Studio

NuGet Package Manager   5.7.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

ProjectServicesPackage Extension   1.0
ProjectServicesPackage Visual Studio Extension Detailed Info

Python   16.7.20248.6
Provides IntelliSense, projects, templates, debugging, interactive windows, and other support for Python developers.

Python - Conda support   16.7.20248.6
Conda support for Python projects.

Python - Django support   16.7.20248.6
Provides templates and integration for the Django web framework.

Python - IronPython support   16.7.20248.6
Provides templates and integration for IronPython-based projects.

Python - Profiling support   16.7.20248.6
Profiling support for Python projects.

SlowCheetah - XML config transforms   1.0
This package enables you to transform your app.config or any other XML file based on the build configuration. It also adds additional tooling to help you create XML transforms.

SQL Server Data Tools   16.0.62008.03130
Microsoft SQL Server Data Tools

ToolWindowHostedEditor   1.0
Hosting json editor into a tool window

TypeScript Tools   16.0.20702.2001
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools   3.7.0-6.20427.1+18ede13943b0bfae1b44ef078b2f3923159bcd32
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools 10.10.0.0 for F# 4.7   16.7.0-beta.20361.3+3ef6f0b514198c0bfa6c2c09fefe41a740b024d5
Microsoft Visual F# Tools 10.10.0.0 for F# 4.7

Visual Studio Code Debug Adapter Host Package   1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Container Tools Extensions (Preview)   1.0
View, manage, and diagnose containers within Visual Studio.

Visual Studio Tools for Containers   1.0
Visual Studio Tools for Containers

Visual Studio Tools for Kubernetes   1.0
Visual Studio Tools for Kubernetes

VisualStudio.DeviceLog   1.0
Information about my package

VisualStudio.Foo   1.0
Information about my package

VisualStudio.Mac   1.0
Mac Extension for Visual Studio

WakaTime   1.0

Xamarin   16.7.000.440 (d16-7@358f3c6)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer   16.7.0.495 (remotes/origin/d16-7@79c0c522c)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates   16.7.85 (1bcbbdf)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK   11.0.2.0 (d16-7/025fde9)
Xamarin.Android Reference Assemblies and MSBuild support.
    Mono: 83105ba
    Java.Interop: xamarin/java.interop/d16-7@1f3388a
    ProGuard: Guardsquare/proguard/proguard6.2.2@ebe9000
    SQLite: xamarin/sqlite/3.32.1@1a3276b
    Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-7@017078f

Xamarin.iOS and Xamarin.Mac SDK   13.20.2.2 (817b6f72a)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
madskristensen commented 3 years ago

Thank you for reporting the issue. It would be super helpful if you could share the code you're copying that causes this issue. I'm not able to reproduce the issue myself.

rer145 commented 3 years ago

It's happened with various lines of code. I can't seem to pinpoint exactly what is triggering it. I've noticed it when copying some JS code from an angular controller, as well as copying some C# code containing EF6 code. I will try to keep a better record of it and provide samples, however, there doesn't seem to be a pattern.

PeterOsterdahl commented 3 years ago

Same for me. vs2019 Enterprise v16.7.6. Any time I copy paste only the visible part of what I copied is actually transferred when pasting. Steps to reproduce: open a file that contains more lines than is visible on screen ctrl A+ctrl C open notepad or another vs file or whatever ctrl V

Expected: All lines from origin pasted into notepad Actual: Only the lines visible when pressing ctrl C are pasted.

Workaround: scroll out until all lines that should be copied are visible, mark and copy

Disabling Tweakster and restarting vs restored the correct copy behaviour.

dizarter commented 3 years ago

"Copy without indentation" set to True. Working with Web.config file (XML).

When I select from the beginning of the line everything is copied.

However, when selection starts from some indented node only partial content is copied, approximately from the first visible line.

dizarter commented 3 years ago

Example file to reproduce the behaviour example.txt Rename it as Web.config and open in VS 2019.

  1. Select from the beginning of line 5 to the end of line 63 - copy / paste into notepad++ works correctly.
  2. Select from the beginning of location node on line 5, again to the end of line 63 - copy / paste into notepad++ - not all text is copied
davesmith9088 commented 3 years ago

I also see this issue a lot. It seems to only happen when copying, i.e. cut + paste works fine.