EFDesigner icon indicating copy to clipboard operation
EFDesigner copied to clipboard

Null Reference exception in Solution Explorer context menu

Open dcastenholz opened this issue 3 years ago • 0 comments
trafficstars

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

dcastenholz avatar Oct 12 '22 19:10 dcastenholz