"Object reference not set to an instance of an object." during SSMS startup

Immediately after starting SQL Server Management Studio I get an UI error report dialogue stating that "Object reference not set to an instance of an object.".

The log file of SQL prompt says:

<div>2022-02-24 11:16:12.868 +01:00 [Information] Logging level set to 'Information'</div><div>2022-02-24 11:16:13.670 +01:00 [Information] Launching package entry point Ssms18 (version 15.0.18390.0) for SQL Prompt 10.11.2.26629.</div><div>2022-02-24 11:16:13.742 +01:00 [Information] Initialising DTE and AddIn connections.</div><div>DTE.FullName: C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE\Ssms.exe</div><div>DTE.Version: 2019.0150</div><div>DTE.CommandLine:&nbsp;</div><div>Current culture: de-AT</div><div>Current UI culture: en-US</div><div>2022-02-24 11:16:14.783 +01:00 [Error] Report error dialog UI shown</div><div>System.NullReferenceException: Object reference not set to an instance of an object.</div><div>&nbsp; &nbsp;at Format.Engine.Styles.Saving.StyleFilePathGenerator.GetFilePath(FormattingStyle style)</div><div>&nbsp; &nbsp;at Format.Engine.Styles.Upgrading.StyleFileNamesUpgrader.<Upgrade>d__5.MoveNext()</div><div>&nbsp; &nbsp;at Format.Engine.Styles.Upgrading.StylesUpgrader.Upgrade()</div><div>&nbsp; &nbsp;at RedGate.SQLPrompt.CommonUI.Shell.StartUpActions.UpgradeFormattingStyles(ILog logger, IStylesUpgrader stylesUpgrader)</div><div>&nbsp; &nbsp;at RedGate.SQLPrompt.CommonUI.Shell.StartUpActions.Run(DevelopmentEnvironment developmentEnvironment)</div><div>&nbsp; &nbsp;at RedGate.SqlPrompt.EntryPointCommon.BaseConnect.Initialize(IKernel kernel, DTE2 dte)</div><div>&nbsp; &nbsp;at RedGate.SqlPrompt.SsmsCommon.AbstractSsmsConnect.Initialize(IKernel kernel, DTE2 dte)</div><div>&nbsp; &nbsp;at RedGate.SqlPrompt.SsmsCommon.AbstractSsmsConnect.VsPackageInitialize(IKernel kernel, DTE dte)</div><div>&nbsp; &nbsp;at RedGate.SQLPrompt.SsmsPackage18.SQLPromptSsmsPackage18.<Initialize>b__2_0(ILog logger, IKernel kernel, Action`1 onTabsRestored)</div><div>&nbsp; &nbsp;at RedGate.SqlPrompt.EntryPointCommon.Startup.<>c__DisplayClass0_0.<Initialize>b__0()</div><div>&nbsp; &nbsp;at RedGate.SQLPrompt.UsageReporting.ErrorReporting.ErrorReporterWithUI.Do(Action action)</div>
I already tried to reinstall SQL Prompt to no avail. Any ideas what could be the reason for this error? I can't use SQL Prompt at all right now.
Tagged:

Answers

  • The problem looks like it is related to your formatting styles.

    Could you let us know the path that you have set for your styles? As you can't start SQL Prompt, you will have to get this from the registry:
    HKEY_CURRENT_USER\Software\Red Gate\SQL Prompt 10\Formatting Styles Folder
    Could you also look in the directory set in that key in the registry and show us a directory listing of the files in there?
    Software Engineer
    Redgate Software
  • tonygruztonygruz Posts: 1 New member
    An Object is an instance of a Class , it is stored some where in memory. A reference is what is used to describe the pointer to the memory location where the Object resides. The message "object reference not set to an instance of an object" means that you are referring to an object the does not exist or was deleted or cleaned up. It's usually better to avoid a NullReferenceException than to handle it after it occurs. To prevent the error, objects that could be null should be tested for null before being used.

    if (mClass != null)
    {
      // Go ahead and use mClass
      mClass.property = ...
    }
    else
    {
      // Attempting to use mClass here will result in NullReferenceException
    }

    A NullReferenceException typically reflects developer error and is thrown in the following scenarios:

    • Forgotten to instantiate a reference type.
    • Forgotten to dimension an array before initializing it.
    • Is thrown by a method that is passed null.
    • Get a null return value from a method, then call a method on the returned type.
    • Using an expression to retrieve a value and, although checking whether the value is null.
    • Enumerating the elements of an array that contains reference types, and attempt to process one of the elements.


Sign In or Register to comment.