Debug the MEF component

Soumabha Sarkar 41 Reputation points
2023-04-04T17:15:43.1766667+00:00

We have used VsPackage (pkgdef file) for our extension. Now we planning to include MEF component for our extension. We have created a new project that will provide the MEF functionality and use the DLL in the vsixmanifest file. We found the following post and tried the same https://social.msdn.microsoft.com/Forums/vstudio/en-US/46a3a98e-a2a7-4e99-abcb-d644e52be098/how-install-mef-dll-with-vspackage?forum=vsx But we cannot see the DLL getting loaded in the modules while opening any text file in Visual Studio. Can anyone please help us on how to debug this issue? We have looked into the Activity Log and Component Model Cache error log file and there are no error listed in there.

Visual Studio Extensions
Visual Studio Extensions
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Extensions: A program or program module that adds functionality to or extends the effectiveness of a program.
178 questions
Visual Studio Debugging
Visual Studio Debugging
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Debugging: The act or process of detecting, locating, and correcting logical or syntactical errors in a program or malfunctions in hardware. In hardware contexts, the term troubleshoot is the term more frequently used, especially if the problem is major.
948 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Tianyu Sun-MSFT 27,796 Reputation points Microsoft Vendor
    2023-04-18T08:55:17.36+00:00

    Hi @Soumabha Sarkar ,

    I tested with the example code and followed this thread How Install MEF Dll With VsPackage. The MEF component loaded and the words highlighted correctly. Here are some suggestions that I suggest you try to check:

    1. You mentioned that you cannot see the MEF component getting loaded in the module window, if you are using the highlighting text example code, when you position the cursor in one of the occurrences of word, will every occurrence be highlighted?
    2. Can you confirm that the MEF component itself works well? If the MEF component itself works well, could you try to create a new VSIX- VSPackage project and configure the MEF component to let it install with VSPackage, then run it to confirm that if this newly created project works?
    3. If the same issue appears on a newly created project, could you please share us some detailed steps about how you create the project, how you set the configurations, and share us some screenshots to check further? Perhaps some steps or configurations are missing.

    Sincerely,

    Tianyu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments