none
MPF Language Service compliation error while overriding AuthoringScope

    Question

  • Hello,

    Trying to follow Implementing a Language Service (MFP) MSDN tutorial with Visual Studio 2010 RC, .NET Framework 4.0, I encounter the following problem. When implementing Microsoft.VisualStudio.Package. AuthoringScope class, it throws two errors during compilation, one saying that the Goto abstract member is not implemented , the other, that this method is implemented but does not find any method to override .

    The code is exactly the same as in the tutorial:

    public override string Goto(Microsoft.VisualStudio.VSConstants.VSStd97CmdID cmd, IVsTextView textView,
     int line, int col, out TextSpan span)
    {
     span = new
     TextSpan();
     return null;
    }

    with:

    using Microsoft.VisualStudio.Package;
    using Microsoft.VisualStudio.TextManager.Interop;

    The related assembly Assemblies\v4.0\Microsoft.VisualStudio.Package.LanguageService.10.0.dll is loaded.

     

    Declaring types explicitly, i.e.:

    public override string Goto(Microsoft.VisualStudio.VSConstants.VSStd97CmdID cmd,
                  Microsoft.VisualStudio.TextManager.Interop.IVsTextView textView,
                  int line,
                  int col,
                  out Microsoft.VisualStudio.TextManager.Interop.TextSpan span)

    has the same result. Removing and recreating the method through Intellisense has also the same result.

     

    Any hint of how to solve this thing?

     

    The exact contents of two errors:

    Error    1    'PelicanDD.VisualStudio.ExtendedHypertextPreprocessor.EhpLanguageService.EhpAuthoringScope' does not implement inherited abstract member 'Microsoft.VisualStudio.Package.AuthoringScope.Goto(Microsoft.VisualStudio.VSConstants.VSStd97CmdID, Microsoft.VisualStudio.TextManager.Interop.IVsTextView, int, int, out Microsoft.VisualStudio.TextManager.Interop.TextSpan )'    G:\...\EhpLanguageService.cs    65    24    [Class declaration]

    Error    2    'PelicanDD.VisualStudio.ExtendedHypertextPreprocessor.EhpLanguageService.EhpAuthoringScope.Goto(Microsoft.VisualStudio.VSConstants.VSStd97CmdID, Microsoft.VisualStudio.TextManager.Interop.IVsTextView, int, int, out Microsoft.VisualStudio.TextManager.Interop.TextSpan )': no suitable method found to override    G:\...\EhpLanguageService.cs    78    36    [Goto method]

    • Edited by MainMa Monday, April 26, 2010 6:17 PM Always trying to display the source code correctly...
    Monday, April 26, 2010 6:06 PM

Answers

  • Hello MainMa,

    Thanks for reporting this issue.

    I have successfully reproduced it in VS 2010 RTM. This is a documentaion issue at http://msdn.microsoft.com/en-us/library/bb165744(v=VS.100).aspx.

    This issue is caused by a reference issue. You can correct the error by the following steps:

    1 Replace the Microsoft.VisualStudio.Package.LanguageService reference with Microsoft.VisualStudio.Package.LanguageService.10.0

    2. Add a new reference Microsoft.VisualStudio.TextManager.Interop.8.0

    3. Add following code in your language service class:

        public override string GetFormatFilterList()
        {
          throw new System.NotImplementedException();
        }

    Please let me know if it works. You can file a bug for it at http://connect.microsoft.com. Thanks.

     


    Hongye Sun [MSFT]
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg @ microsoft.com

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    See what's happening in MSDN forum? Follow us at Twitter.
    • Marked as answer by MainMa Tuesday, April 27, 2010 3:07 PM
    Tuesday, April 27, 2010 4:22 AM
    Moderator

All replies

  • Have you tried managed Babel?There is already a AuthoringScope class defined within managed Babel. So,, i'm a bit confused why you want to implement it by yourself.

    I think to implement a language service, the hard part,, is to overrite the parse class and scanner class, and Resover class aswell,, they are places you need to pay attention to if you want  to add more functionatlity..


    Thanks, B.C.
    Tuesday, April 27, 2010 3:13 AM
  • Hello MainMa,

    Thanks for reporting this issue.

    I have successfully reproduced it in VS 2010 RTM. This is a documentaion issue at http://msdn.microsoft.com/en-us/library/bb165744(v=VS.100).aspx.

    This issue is caused by a reference issue. You can correct the error by the following steps:

    1 Replace the Microsoft.VisualStudio.Package.LanguageService reference with Microsoft.VisualStudio.Package.LanguageService.10.0

    2. Add a new reference Microsoft.VisualStudio.TextManager.Interop.8.0

    3. Add following code in your language service class:

        public override string GetFormatFilterList()
        {
          throw new System.NotImplementedException();
        }

    Please let me know if it works. You can file a bug for it at http://connect.microsoft.com. Thanks.

     


    Hongye Sun [MSFT]
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg @ microsoft.com

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    See what's happening in MSDN forum? Follow us at Twitter.
    • Marked as answer by MainMa Tuesday, April 27, 2010 3:07 PM
    Tuesday, April 27, 2010 4:22 AM
    Moderator
  • This issue is caused by a reference issue. You can correct the error by the following steps:

    1 Replace the Microsoft.VisualStudio.Package.LanguageService  reference with Microsoft.VisualStudio.Package.LanguageService.10.0

    2. Add a new reference Microsoft.VisualStudio.TextManager.Interop.8.0

    [...]

    Thanks for your help.

    Is was effectively an issue with the references, but I can't find what references were causing this problem. I had already LanguageService.10.0 declared. Don't remember what TextManager.Interop.* were declared.

    Currently I have Microsoft.VisualStudio.Package.LanguageService.10.0, Microsoft.VisualStudio.Shell.Immutable.10.0, Microsoft.VisualStudio.Shell.Interop[.8.0 to 10.0] and Microsoft.VisualStudio.TextManager.Interop[.8.0]. It works.

     

    Thank you.

    Tuesday, April 27, 2010 3:15 PM
  • Have you tried managed Babel?There is already a AuthoringScope class defined within managed Babel. So,, i'm a bit confused why you want to implement it by yourself.

    I think to implement a language service, the hard part,, is to overrite the parse class and scanner class, and Resover class aswell,, they are places you need to pay attention to if you want  to add more functionatlity..


    Thanks, B.C.


    No, I didn't tried that, because I were unaware of this thing.

    Well, the problem is solved. But thank you for your reply. Maybe will need to use managed Babel in future.

    Tuesday, April 27, 2010 3:18 PM