EFDesigner
EFDesigner copied to clipboard
Null Reference exception in Solution Explorer context menu
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:
- Load solution with .efmodel file in it.
- 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