Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

Null Reference exception in Solution Explorer context menu #324

Open
dcastenholz opened this issue Oct 12, 2022 · 0 comments
Open

Null Reference exception in Solution Explorer context menu #324

dcastenholz opened this issue Oct 12, 2022 · 0 comments
Labels
bug Confirmed bug

Comments

@dcastenholz
Copy link
Contributor

I found an edge case where the Solution Explorer context menu for 'Generate Code' can cause a null reference exception. Happens only before the extension is loaded, so it is rare. Steps to reproduce are:

  1. Load solution with .efmodel file in it.
  2. Immediately right-click on .efmodel file and select 'Generate Code'.

Fix:

      private void OnMenuSolutionExplprerGenerateCode(object sender, EventArgs e)
      {
         if (solutionExplorerSelectedFileInfo == null)
         {
            solutionExplorerSelectedFileInfo = new FileInfo(CommandHelper.GetSingleFileSelectedPath());
         }

         CommandHelper.GenerateCode(solutionExplorerSelectedFileInfo.FullName);
      }

in DslPackage\CustomCode\CommandSet.cs

@msawczyn msawczyn added the bug Confirmed bug label Jan 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Confirmed bug
Projects
None yet
Development

No branches or pull requests

2 participants