7.3.0.568 - Formatting += fails
henrik_ffc
Posts: 11 Bronze 2
The following SQL fails to be formatted using default style:
DECLARE @txt NVARCHAR(MAX) = '';
SELECT @txt += '';
The Error dialog tells me:
Error laying out sql.
SQL PRompt was unable to complete this operation.
Problems areas have been highlighted.
The log file contains the following error:
WARN RedGate.SqlPrompt.ScriptDomInterop.FormatterV2 - Error at range (0:1): System.ArgumentNullException: Value cannot be null.
Parameter name: token
at ..(TSqlFragment , TSqlParserToken , Boolean )
at ..(SelectSetVariable )
at ..(SelectSetVariable )
at Microsoft.SqlServer.TransactSql.ScriptDom.TSqlFragmentVisitor.ExplicitVisit(SelectSetVariable node)
at Microsoft.SqlServer.TransactSql.ScriptDom.SelectSetVariable.Accept(TSqlFragmentVisitor visitor)
at Microsoft.SqlServer.TransactSql.ScriptDom.QuerySpecification.AcceptChildren(TSqlFragmentVisitor visitor)
at Microsoft.SqlServer.TransactSql.ScriptDom.TSqlFragmentVisitor.ExplicitVisit(QuerySpecification node)
at Microsoft.SqlServer.TransactSql.ScriptDom.QuerySpecification.Accept(TSqlFragmentVisitor visitor)
at Microsoft.SqlServer.TransactSql.ScriptDom.SelectStatement.AcceptChildren(TSqlFragmentVisitor visitor)
at Microsoft.SqlServer.TransactSql.ScriptDom.TSqlFragmentVisitor.ExplicitVisit(SelectStatement node)
at Microsoft.SqlServer.TransactSql.ScriptDom.SelectStatement.Accept(TSqlFragmentVisitor visitor)
at Microsoft.SqlServer.TransactSql.ScriptDom.TSqlBatch.AcceptChildren(TSqlFragmentVisitor visitor)
at Microsoft.SqlServer.TransactSql.ScriptDom.TSqlFragmentVisitor.ExplicitVisit(TSqlBatch node)
at Microsoft.SqlServer.TransactSql.ScriptDom.TSqlBatch.Accept(TSqlFragmentVisitor visitor)
at Microsoft.SqlServer.TransactSql.ScriptDom.TSqlScript.AcceptChildren(TSqlFragmentVisitor visitor)
at Microsoft.SqlServer.TransactSql.ScriptDom.TSqlFragmentVisitor.ExplicitVisit(TSqlScript node)
at Microsoft.SqlServer.TransactSql.ScriptDom.TSqlScript.Accept(TSqlFragmentVisitor visitor)
at Format.Engine.Formatting.SqlFormatter.Format(String script, IScriptWriter scriptWriter, CancellationToken cancellationToken, IList`1& parseErrors)
at RedGate.SqlPrompt.ScriptDomInterop.Format.FormatterV2.FormatScript(String script, LayoutOptions activeStyle, IList`1& formatErrors)
at RedGate.SqlPrompt.ScriptDomInterop.Format.FormatterV2.FormatScript(String script, String activeStyleName, ITextWriterInterop textWriter, Int32 startIndex)
DECLARE @txt NVARCHAR(MAX) = '';
SELECT @txt += '';
The Error dialog tells me:
Error laying out sql.
SQL PRompt was unable to complete this operation.
Problems areas have been highlighted.
The log file contains the following error:
WARN RedGate.SqlPrompt.ScriptDomInterop.FormatterV2 - Error at range (0:1): System.ArgumentNullException: Value cannot be null.
Parameter name: token
at ..(TSqlFragment , TSqlParserToken , Boolean )
at ..(SelectSetVariable )
at ..(SelectSetVariable )
at Microsoft.SqlServer.TransactSql.ScriptDom.TSqlFragmentVisitor.ExplicitVisit(SelectSetVariable node)
at Microsoft.SqlServer.TransactSql.ScriptDom.SelectSetVariable.Accept(TSqlFragmentVisitor visitor)
at Microsoft.SqlServer.TransactSql.ScriptDom.QuerySpecification.AcceptChildren(TSqlFragmentVisitor visitor)
at Microsoft.SqlServer.TransactSql.ScriptDom.TSqlFragmentVisitor.ExplicitVisit(QuerySpecification node)
at Microsoft.SqlServer.TransactSql.ScriptDom.QuerySpecification.Accept(TSqlFragmentVisitor visitor)
at Microsoft.SqlServer.TransactSql.ScriptDom.SelectStatement.AcceptChildren(TSqlFragmentVisitor visitor)
at Microsoft.SqlServer.TransactSql.ScriptDom.TSqlFragmentVisitor.ExplicitVisit(SelectStatement node)
at Microsoft.SqlServer.TransactSql.ScriptDom.SelectStatement.Accept(TSqlFragmentVisitor visitor)
at Microsoft.SqlServer.TransactSql.ScriptDom.TSqlBatch.AcceptChildren(TSqlFragmentVisitor visitor)
at Microsoft.SqlServer.TransactSql.ScriptDom.TSqlFragmentVisitor.ExplicitVisit(TSqlBatch node)
at Microsoft.SqlServer.TransactSql.ScriptDom.TSqlBatch.Accept(TSqlFragmentVisitor visitor)
at Microsoft.SqlServer.TransactSql.ScriptDom.TSqlScript.AcceptChildren(TSqlFragmentVisitor visitor)
at Microsoft.SqlServer.TransactSql.ScriptDom.TSqlFragmentVisitor.ExplicitVisit(TSqlScript node)
at Microsoft.SqlServer.TransactSql.ScriptDom.TSqlScript.Accept(TSqlFragmentVisitor visitor)
at Format.Engine.Formatting.SqlFormatter.Format(String script, IScriptWriter scriptWriter, CancellationToken cancellationToken, IList`1& parseErrors)
at RedGate.SqlPrompt.ScriptDomInterop.Format.FormatterV2.FormatScript(String script, LayoutOptions activeStyle, IList`1& formatErrors)
at RedGate.SqlPrompt.ScriptDomInterop.Format.FormatterV2.FormatScript(String script, String activeStyleName, ITextWriterInterop textWriter, Int32 startIndex)
// Henrik
Comments
Thanks for letting us know about this! We have managed to reproduce it and will include the fix in the next release.
Best regards,
David
We've put in a fix for this in the latest update, which you can download through Check for updates or from the announcement post.
Could you let us know if it solves your problem?
Best regards,
David
Thanks!
// Henrik