Community
    • Login

    Weird issues with multiple C# plugin projects, debugging goes to different project

    Scheduled Pinned Locked Moved Notepad++ & Plugin Development
    4 Posts 3 Posters 327 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Bas de ReuverB
      Bas de Reuver
      last edited by

      The past few weeks I’ve created three different C# plugin projects for testing and trying things out. But now I encounter a weird problem when debugging the newest project.

      I’ve installed the template in .\Documents\Visual Studio 2019\Templates\ProjectTemplates\Visual C#\NppPlugin0.95.00.zip and then create a new project based on that template.

      Btw an aside note; in the Visual Studio create new project window, using the text search I can’t find a “notepad” or “NPP” template. Only when I clear all three filters (All Languages, All Platforms, All Project Types) only then the template shows at the bottom of the list.

      But anyway when I debug the Main.cs of my most recent project, Visual Studio somehow goes to the Main.cs of my very first project, and that other project wasn’t even opened in Visual Studio. I suspect that maybe it has to do with this line in AssemblyInfo.cs

      // The following GUID is for the ID of the typelib if this project is exposed to COM
      [assembly: Guid("31492674-6fe0-485c-91f0-2e17244588ff")]
      

      Am I correct in assuming this needs to be changed to a random unique Guid for every new project? If so, is it possible to automate this from the template somehow?

      Still, after I change the Guid the problem still occurs. It might also be a Namespace related issue, because the Main.cs uses the namespace Kbg.NppPluginNET from the template, but the default namespace (Project Properties -> Application -> Default namespaces) is set to the project name.

      Any ideas on how to solve this debugging issue?

      1 Reply Last reply Reply Quote 0
      • Bas de ReuverB
        Bas de Reuver
        last edited by Bas de Reuver

        (why can’t I edit my post after three minutes?) Anyway I forgot to mention that when debugging the Stack Frame dropdownlist also shows this other project:

        CSVLint.dll!Kgb.NppPluginNET.Main.CommandMenuInit() Line 39
        CSVLint.dll!Kgb.NppPluginNET.Main.UnmanagedExports.setInfo(Kgb.NppPluginNET.PluginInfrastructure.NppData notepadPlusData line 21)
        
        EkopalypseE Alan KilbornA 2 Replies Last reply Reply Quote 0
        • EkopalypseE
          Ekopalypse @Bas de Reuver
          last edited by Ekopalypse

          @Bas-de-Reuver

          The mentioned GUID is relevant for projects that create COM objects.
          In this case it MUST have a unique ID, but as far as I understand the C# template, this is not something that is exported by default.
          Namespaces must be unique per project and are basically the upper hierarchy of classes used.

          The part that I suspect is the problem, please keep in mind. that I am not a C# developer, is the assembly manifests.
          My understanding is that these define how the assembly is loaded into the Global Assembly Cache.

          1 Reply Last reply Reply Quote 3
          • Alan KilbornA
            Alan Kilborn @Bas de Reuver
            last edited by

            @Bas-de-Reuver said in Weird issues with multiple C# plugin projects, debugging goes to different project:

            why can’t I edit my post after three minutes?

            Because those are the rules here.

            1 Reply Last reply Reply Quote 2
            • First post
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors