1. Steve Cadwallader
  2. CodeMaid
Issue #78 resolved

unable to reorganize classes most of the time

Anonymous created an issue

most of the time i can't reorganize the classes some times it does work when it fails i get the following error: CodeMaid stopped reorganizing 'classname.cs':System.Runtime.InteropServices.COMException (0x800401D0): OpenCliboard Failed (Exception from HRESULT:0x800401D0 (CLIPBRD_E_CANT_OPEN)) at EvnDTE.EditPoint.Paste() at SteveCadwallader.CodeMaid.Helpers.CodeReorderHel...

i use visual studio 2010 SP1

Comments (8)

  1. Anonymous

    it happens when ever i try to reorganize a class, there isn't a specific class. after i receive the error there is always something left in the clipboard, that is part of the code. i tried to delete this part or the next thinking it is related to that but no good, there is not a specific string that causes this. I tried to uninstall codemaid and re-install it this doesn't help.

  2. Steve Cadwallader repo owner

    I'm sorry for the trouble you are having and would like to help. The best way I can do that is if you can send me a code sample that consistently causes the issue. Also, do you have any other extensions or applications installed that might be doing something special with the clipboard?

  3. Mario Mainz

    I have the same problem, but I think I may know why it happens. I have Windows running in a virtual machine on VirtualBox. There are VirtualBox guest additions installed on the Windows system, which are sharing the clipboard between the host and the guest system. When I close the guest additions on the virtual machine through task manager the reorganizing in CodeMaid works again.

  4. Anonymous

    I've been having the same trouble, using VS2010 SP1

    Error is this, unfortunately I can't get the rest of it as it is cut off in the status bar at the bottom.

    CodeMain stopped reorganizing 'Class1.cs': System.Runtime.InteropServices.COMException (0x800401D0): OpenClipboard Failed (Exception from HRESULT: 0x800401D0 (CLIPBRD_E_CANT_OPEN)) at EnvDTE.EditPoint.Paste() at SteveCadwallader.CodeMaid.Helpers.CodeReorderHelper.Re...
    

    Here's some code that does it

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    namespace YAMP
    {
        class Class1
        {
            public int boo;
    
            public int BOO()
            {
                return boo;
            }
    
            public bool state;
    
            public bool STATE()
            {
                return state;
            }
        }
    }
    
  5. Mathew Spearey

    I've been having the same trouble, using VS2010 SP1

    Error is this, unfortunately I can't get the rest of it as it is cut off in the status bar at the bottom.

    CodeMain stopped reorganizing 'Class1.cs': System.Runtime.InteropServices.COMException (0x800401D0): OpenClipboard Failed (Exception from HRESULT: 0x800401D0 (CLIPBRD_E_CANT_OPEN)) at EnvDTE.EditPoint.Paste() at SteveCadwallader.CodeMaid.Helpers.CodeReorderHelper.Re...
    

    Here's some code that does it

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    namespace YAMP
    {
        class Class1
        {
            public int boo;
    
            public int BOO()
            {
                return boo;
            }
    
            public bool state;
    
            public bool STATE()
            {
                return state;
            }
        }
    }
    

    Forgot to add that it happens at my work machine and my machine at home.

  6. Steve Cadwallader repo owner

    Thanks Mario and Mathew for the details. It sounds like at least for Mario it is specifically a conflict with using the clipboard within a VM environment.

    I will change the reorganization logic to not use the clipboard as a holding place for code that is being moved. It was a simple mechanism integrated into the EnvDTE.EditPoint class via its Cut/Paste methods but I can manually hold onto the code as an alternative to bypass the conflict.

    Thank again for the details and I plan to have this changed in the next release.

  7. Steve Cadwallader repo owner

    I have just pushed the change to the CodeReorderHelper to not utilize the clipboard in order to avoid any conflict with clipboard management by VM or other utilities. This will be present in the next release.

  8. Log in to comment