3

I have a VSIX project that targets Visual Studio 2012 and it works fine. But when I updated the project to target Visual Studio 2013. The follow function "VsTextViewCreated" wasn't called

using Microsoft.VisualStudio.Editor;
using Microsoft.VisualStudio.Language.Intellisense;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.TextManager.Interop;
using Microsoft.VisualStudio.Utilities;
using SnippetsUI;
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace VSIXProject1
{
    class CompletionHandler
    {
        [Export(typeof(IVsTextViewCreationListener))]
        [ContentType("CSharp")]
        [Name("CodeCompletionTypeZero")]
        [TextViewRole(PredefinedTextViewRoles.Editable)]
        internal class CompletionHandlerProvider : IVsTextViewCreationListener
        {
            [Import]
            internal IVsEditorAdaptersFactoryService _adapterService = null;
            [Import]
            internal ICompletionBroker _completionBroker { get; set; }
            [Import]
            internal SVsServiceProvider _serviceProvider { get; set; }

            public void VsTextViewCreated(IVsTextView textViewAdapter)
            {
                Printer.Print("VsTextViewCreated");
                ITextView textView = _adapterService.GetWpfTextView(textViewAdapter);
                if (textView == null)
                {
                    return;
                }
                return;
            }
        }
    }
}

What's more, if I want to set a break point at this line: "Printer.Print("VsTextViewCreated");" I got "the breakpoint will not currently be hit. No symbols have been loaded for this document"

Thanks everyone who had read this far :)

csharpwinphonexaml
  • 3,659
  • 10
  • 32
  • 63
Yinthewind
  • 55
  • 1
  • 6

1 Answers1

0

Delete

"C:\Users\yourusername\AppData\Local\yourCompanyName" and "C:\Users\yourusername\AppData\Local\Microsoft\VisualStudio\12.0Exp"

Also, modify your VSIXxShellExtensions manifest file and mark your package as "MEFComponent".

This is also good topic: VSIX extension for VS2012 not running when debugging

Community
  • 1
  • 1
Erti-Chris Eelmaa
  • 25,338
  • 6
  • 61
  • 78