What are the challenges you face when working across database platforms? Take the survey
Options

Importing snippets into ADS failing

Hi, getting this exception on startup.
 
Failed to import snippets from SSMS: Error: Unhandled exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.Text.Json.JsonException: '<' is an invalid start of a value. Path: $ | LineNumber: 0 | BytePositionInLine: 0.
 ---> System.Text.Json.JsonReaderException: '<' is an invalid start of a value. LineNumber: 0 | BytePositionInLine: 0.
   at System.Text.Json.ThrowHelper.ThrowJsonReaderException(Utf8JsonReader& json, ExceptionResource resource, Byte nextByte, ReadOnlySpan`1 bytes)
   at System.Text.Json.Utf8JsonReader.ConsumeValue(Byte marker)
   at System.Text.Json.Utf8JsonReader.ReadFirstToken(Byte first)
   at System.Text.Json.Utf8JsonReader.ReadSingleSegment()
   at System.Text.Json.Utf8JsonReader.Read()
   at System.Text.Json.JsonSerializer.ReadCore(JsonSerializerOptions options, Utf8JsonReader& reader, ReadStack& readStack)
   --- End of inner exception stack trace ---
   at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& readStack, JsonReaderException ex)
   at System.Text.Json.JsonSerializer.ReadCore(JsonSerializerOptions options, Utf8JsonReader& reader, ReadStack& readStack)
   at System.Text.Json.JsonSerializer.ReadCore(Type returnType, JsonSerializerOptions options, Utf8JsonReader& reader)
   at System.Text.Json.JsonSerializer.Deserialize(String json, Type returnType, JsonSerializerOptions options)
   at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, JsonSerializerOptions options)
   at RedGate.SqlPrompt.SnippetConverter.Ssms.Json.SsmsJsonSnippetSerializer.Deserialize(Stream stream) in \D:\BuildAgentB\work\dc5fefc0dc183d00\SnippetConverter\Ssms\Json\SsmsJsonSnippetSerializer.cs:line 12
   at RedGate.SqlPrompt.SnippetConverter.Ssms.SsmsSnippets.LoadSsmsSnippet(String fileName) in \D:\BuildAgentB\work\dc5fefc0dc183d00\SnippetConverter\Ssms\SsmsSnippets.cs:line 33
   at System.Linq.Enumerable.SelectArrayIterator`2.MoveNext()
   at System.Linq.Enumerable.WhereEnumerableIterator`1.ToList()
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at RedGate.SqlPrompt.SnippetConverter.SsmsToAdsSnippetConverter.Convert(String ssmsSnippetsFolder, String adsSnippetsFile) in \D:\BuildAgentB\work\dc5fefc0dc183d00\SnippetConverter\SsmsToAdsSnippetConverter.cs:line 21
   at RedGate.SqlPrompt.SnippetConverter.Program.Run(Logger logger, Options options) in \D:\BuildAgentB\work\dc5fefc0dc183d00\SnippetConverter\Program.cs:line 79
   at RedGate.SqlPrompt.SnippetConverter.Program.<>c__DisplayClass1_0.<Main>b__0(Options options) in \D:\BuildAgentB\work\dc5fefc0dc183d00\SnippetConverter\Program.cs:line 34
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Delegate.DynamicInvokeImpl(Object[] args)
   at System.Delegate.DynamicInvoke(Object[] args)
   at System.CommandLine.Invocation.ModelBindingCommandHandler.InvokeAsync(InvocationContext context)
   at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass23_0.<<UseParseErrorReporting>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass16_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass27_0.<<UseVersionOption>b__1>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass25_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__24_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<<UseParseDirective>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass11_0.<<UseDebugDirective>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__10_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass14_0.<<UseExceptionHandler>b__0>d.MoveNext()

From the log SnippetConverter202109161644.log

2021-09-16 16:44:11.385 -04:00 [INF] ------------------------------------------------------------------------------------------------------------------------

2021-09-16 16:44:11.541 -04:00 [INF] Supplied locations:

  SSMS: Default

  ADS:  Default

2021-09-16 16:44:11.542 -04:00 [INF] Finding default SSMS snippets location

2021-09-16 16:44:11.548 -04:00 [INF] Default SSMS snippets location: C:\Users\ersabine\AppData\Local\Red Gate\SQL Prompt 10\Snippets

2021-09-16 16:44:11.548 -04:00 [INF] Finding default ADS snippets location

2021-09-16 16:44:11.549 -04:00 [INF] Default ADS snippets location: C:\Users\ersabine\AppData\Roaming\azuredatastudio\User\Snippets\sql.json

2021-09-16 16:44:11.549 -04:00 [INF] Converting snippets



Versions:

ADS: 1.32.0

SQL Prompt: 10.6.19.22009

ADS Sql Prompt: 0.2.8


Tagged:

Best Answer

  • Options
    ersabineersabine Posts: 4 New member
    Following up here to share the resolution, it was observed by Red Gate that in my C:\Users\ersabine\AppData\Local\Red Gate\SQL Prompt 10\Snippets folder, there were files of the .sqlpromptstylev2 extension. After removing them (leaving only the .json snippets in the folder), the snippet import was successful.

Answers

  • Options
    Hi @ersabine

    I'm sorry you are experiencing this issue with SQL Prompt! Thanks for reaching out to us on this.

    We are aware that there is a bug in relation to the importing of snippets in ADS that is affecting a small number of customers. Our development team are working on a fix for this.

    Also, the latest version of the ADS addin requires a fairly recent version of SQL Prompt to work properly. As an initial action on this, please can you update to the very latest version of SQL Prompt to see if you continue to experience this issue?

    Version 10.8.2 can be downloaded direction from here: https://download.red-gate.com/checkforupdates/SQLPrompt/SQLPrompt_10.8.2.23489.exe 



    Kind regards

    Dan Jary | Redgate Software
    Have you visited our Help Center?
  • Options
    ersabineersabine Posts: 4 New member
    Thank you @Dan_J for following up.  I updated to 10.8.2.23489 and experience the identical error on startup. I acknowledge that you said this is a known bug impacting only some customers. Looking forward to the update.  Thanks!
  • Options

    Thanks for coming back to me on this. I'm sorry that updating has not resolved this issue for you.

    I have highlighted to our development team that you are experiencing this issue, I will come back to you as soon as I have an update for you on this.

    Kind regards

    Dan Jary | Redgate Software
    Have you visited our Help Center?
  • Options

    I am currently engaging with our development team on this. They have asked if it might be possible for you to send us a copy of your Snippets folder (C:\Users\ersabine\AppData\Local\Red Gate\SQL Prompt 10\Snippets). Would this be possible?

    If so, I will reach out to you directly from the ticket we have open for this issue, so that you can provide this folder securely.
    Kind regards

    Dan Jary | Redgate Software
    Have you visited our Help Center?
  • Options
    ersabineersabine Posts: 4 New member
    Yes @Dan_J I can do that. Please send me a link to upload or an email I can use. Thanks
  • Options
    VBJVVBJV Posts: 13 Bronze 2
    I know this is a little late, but I had a similar, but not identical, problem quite a while ago.  Mine was caused by a rogue character or two in the "description" of the snippet defined in SQL Prompt (for SSMS).  I would check there to make sure you don't have any special characters there that might throw the parser for a loop.  Once I changed the descriptions (I actually direct-edited the snippet file) of the offending snippets, the parser/imported worked just fine.
  • Options
    reisingercgreisingercg Posts: 1 New member
    Hello,

    I have the same issue, is there a fix for this? 
    Thanks in advance for hte help.

    Failed to import snippets from SSMS: Error: A fatal error occurred. The required library hostfxr.dll could not be found.
    If this is a self-contained application, that library should exist in [c:\Users\reisingercg_CADM\.azuredatastudio\extensions\redgate.sql-prompt-0.2.11\out\SnippetConverter\].
    If this is a framework-dependent application, install the runtime in the global location [C:\Program Files\dotnet] or use the DOTNET_ROOT environment variable to specify the runtime location or register the runtime location in [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x64\InstallLocation].

    The .NET Core runtime can be found at:


    Version Information:
    ADS Version
    Version: 1.40.2 (system setup)
    Commit: 661384637db384fe5d4e6224069adbe708580b16
    Date: 2022-12-22T22:17:02.658Z
    VS Code: 1.67.0
    Electron: 17.4.11
    Chromium: 98.0.4758.141
    Node.js: 16.13.0
    V8: 9.8.177.14-electron.0
    OS: Windows_NT x64 10.0.19045

    ADS Redgate SQL Prompt  v0.2.11 

    SMSS Redgate SQL Prompt V10.13.3.32087

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file