SQL Prompt 10.5.x not loading in Visual Studio 2017/2019

TheoLTheoL Posts: 17 Bronze 1
I mostly use SQL Prompt in SSMS 18.x - and it's working fine there.
However, when trying to use in Visual Studio 2017 (or 2019) to format SQL code, the moment I enter the "Format SQL", I get an error message indicating SQL Prompt could not load.
When looking at the ActivityLog.xml I have:

SetSite failed for package [SQLPromptPackage]Source: 'RedGate.SQLPrompt.UsageReporting' Description: The type initializer for 'Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration' threw an exception. 
(followed by many more line of error message)
This is located after the entry 
Begin package load [SQLPromptPackage]
Further, in the SQL Prompt log, the following content shows:

2021-01-06 18:06:29.147 +00:00|Error||| Failed to initialize the licensing client
2021-01-06 18:06:29.148 +00:00|Error||| Report error dialog UI shown

Certainly SQL Prompt in SSMS is working, as well as other tools from SQL Toolbelt, so this might not be related.

Uninstalling / re-installing SQL Prompt 10.5.3 made no difference.

As it stands, for me SQL Prompt is completely non-functional in Visual Studio 2017/2019.

Anyone else having these sorts of issues?

Answers

  • TheoLTheoL Posts: 17 Bronze 1
    I can confirm that if I revert to version 10.4.7, the problem goes away.
  • Hi Theo,

    The issue could be due to a different version of a dll being needed by Visual Studio and the latest SQL Prompt version.
    Could you try the following steps:
    1. Upgrade from 10.4.7 to SQL Prompt 10.5.3
    2. In Visual Studio select the option to "Disable local Application Insights for Asp .Net Core web projects"
    This can be done from : 
    “TOOLS –> Options –> Projects and Solutions –> Web Projects” and check “Disable local Application Insights for Asp.Net Core web projects.”



    3. Try the Format SQL

    Please do let us know if this does work for you.

    Regards,
    Sujay
    Product Support Engineer | Redgate Software

    Have you visited our 
    Help Center?
  • TheoLTheoL Posts: 17 Bronze 1
    Thanks for the update. I tried this, but no change. Not noted before, the SQL Prompt main menu item fails to show when opening any SQL file.  I tested on Visual Studio 2017 Enterprise 15.9.30.

    The full error message from ActivityLog.xml:

    Begin package load [SQLPromptPackage]

    SetSite failed for package [SQLPromptPackage]Source: 'RedGate.SQLPrompt.UsageReporting' Description: The type initializer for 'Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration' threw an exception. System.TypeInitializationException: The type initializer for 'Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration' threw an exception. ---> System.TypeLoadException: Could not load type 'System.Diagnostics.Activity' from assembly 'System.Diagnostics.DiagnosticSource, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. at Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration.<>c.<.cctor>b__13_0() at Microsoft.ApplicationInsights.ActivityExtensions.TryRun(Action action) at Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration..cctor() --- End of inner exception stack trace --- at RedGate.SQLPrompt.UsageReporting.AppInsightsClient.GetClient() at RedGate.SQLPrompt.UsageReporting.AppInsightsClient.get_Client() at RedGate.SQLPrompt.UsageReporting.ErrorReporting.ErrorReporter.CreateExceptionReporterController(Exception e, Boolean doRateLimit, Boolean shownToUser, Boolean includeUsersEmailAddress) at RedGate.SQLPrompt.UsageReporting.ErrorReporting.ErrorReporter.ShowError(Exception exception) at RedGate.SQLPrompt.VsPackage.SQLPromptPackage.<InitializeAsync>d__2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.Shell.AsyncPackage.<>c__DisplayClass16_0.<<Microsoft-VisualStudio-Shell-Interop-IAsyncLoadablePackageInitialize-Initialize>b__1>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.Threading.JoinableTask.<JoinAsync>d__78.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.VisualStudio.Services.VsTask.RethrowException(AggregateException e) at Microsoft.VisualStudio.Services.VsTask.InternalGetResult(Boolean ignoreUIThreadCheck) at Microsoft.VisualStudio.Services.VsTask.GetResult()System.TypeLoadException: Could not load type 'System.Diagnostics.Activity' from assembly 'System.Diagnostics.DiagnosticSource, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. at Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration.<>c.<.cctor>b__13_0() at Microsoft.ApplicationInsights.ActivityExtensions.TryRun(Action action) at Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration..cctor()

    End package load [SQLPromptPackage]

    I have "Application Insights Tools for Visual Studio Package - 8.14.20131.1" extension installed - part of the "Developer Analytics Tools" extension from Microsoft.

    I tested both disabling and uninstalling the "Developer Analytics Tools" (and restarting), but neither of these changed the outcome.  

  • Hi Theo,

    Thank you for the update. I have escalated the issue to the development team along with the latest logs and that disabling the Local Application Insights did not solve the problme. I will let you know as soon as I get an update from the development team.

    Regards,
    Sujay
    Product Support Engineer | Redgate Software

    Have you visited our 
    Help Center?
  • TheoLTheoL Posts: 17 Bronze 1
    SQL Prompt 10.5.6.17542 still has not resolved the issue  :/
  • Hi Theo,

    The issue is not yet fixed in 10.5.6.17542. I have once again escalated this to the development team and will let you know once there is an update

    Regards,
    Sujay
    Product Support Engineer | Redgate Software

    Have you visited our 
    Help Center?
  • Hi!
    Any update on this - the error still remains...
    Thanks!
  • Hi Torsten,

    The issue is still being looked into by the development team. We will post here as soon as there is any update available.
    We appreciate your patience while we look into this.

    Regards,
    Sujay

    Product Support Engineer | Redgate Software

    Have you visited our 
    Help Center?
  • TheoLTheoL Posts: 17 Bronze 1
    Just tested SQL Prompt 10.6.2.
    Result:
    Visual Studio 2017: Error still present 
    Visual Studio 2019: Appears to load OK - at least enough to appear in the menu. Did not test further before reverting back  to version 10.4.7

    These tests are done on the same computer.
  • albert_gouwsalbert_gouws Posts: 1 New member
    edited February 21, 2021 8:42PM
    I'm also getting this issue. 

    Edit: More details:

    SQL Prompt 10.6.2.18034
    Visual Studio 2019, 16.8.5

  • Just installed the latest update and again SQL Prompt is uninstalled from VS2019 but not updated. I have to reinstall SQL Prompt then with the toolbelt
    It would be great if you can fix this - thanks!
  • The problem is that the latest release of SQL Pormpt is not part of the SQL Toolbelt yet.
    Therefore I am back to the former version by updating and reinstalling ...
    It would be very helpful to ensure that the latest release is immediatly pushed to the SQL Toolbelt download- many thanks!
  • TheoLTheoL Posts: 17 Bronze 1
    @Sujay For those still affected by this issue, could you please include the link to download SQL Prompt version 10.4.7.
  • Just installed the latest update and again SQL Prompt is uninstalled from VS2019 but not updated. I have to reinstall SQL Prompt then with the toolbelt
    It would be great if you can fix this - thanks!
    Hi Torsten,

    The SQL Toolbelt at https://download.red-gate.com/installers/SQLToolbelt/2021-02-23/SQLToolbelt.exe has the updated version of SQL Prompt. 

    Regards,
    Sujay
    Product Support Engineer | Redgate Software

    Have you visited our 
    Help Center?
  • TheoL said:
    @Sujay For those still affected by this issue, could you please include the link to download SQL Prompt version 10.4.7.
    Hi Theo,

    That is a good suggestion. The 10.4.7 build is available at https://download.red-gate.com/checkforupdates/SQLPrompt/SQLPrompt_10.4.7.16599.exe 

    Regards,
    Sujay
    Product Support Engineer | Redgate Software

    Have you visited our 
    Help Center?
  • The issue has been fixed in SQL Prompt version 10.6.2 and later for Visual Studio 2019.

    For Visual Studio 2017, the development team has reviewed the issue.
    Unfortunately, on this occasion, they are unable to work on a fix for this bug.
    However, they have advised that a workaround can be used to overcome the issue.
    In Visual Studio 2017, there is a conflict with Xamarian tools, and uninstalling these helps to stop the error.

    Regards,
    Sujay
    Product Support Engineer | Redgate Software

    Have you visited our 
    Help Center?
  • AndyRAndyR Posts: 1 New member
    I uninstalled xamarin (which thankfully I'm not using at the moment) and SQL prompt seems to work ok for me now. 
Sign In or Register to comment.