Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verify that GenerateCreateScript works #599

Merged
merged 4 commits into from
Aug 2, 2024

Conversation

ErikEJ
Copy link
Collaborator

@ErikEJ ErikEJ commented Aug 1, 2024

relates to #591

@ErikEJ ErikEJ requested review from jmezach and jeffrosenberg August 1, 2024 13:55
@ErikEJ
Copy link
Collaborator Author

ErikEJ commented Aug 1, 2024

@bheemvennapureddy FYI

@bheemvennapureddy
Copy link

Hi @ErikEJ,

I hope you don't mind, but I'm encountering some issues. I created a codespace with your branch and ran dotnet build on the test project, but I'm still seeing build errors. Could you help me figure out what I might be doing wrong?

Thanks!
Screenshot 2024-08-01 at 10 19 12 AM

@bheemvennapureddy
Copy link

Also in the ci are we not running all the tests? I only see one project

Screenshot 2024-08-01 at 10 23 23 AM

@ErikEJ
Copy link
Collaborator Author

ErikEJ commented Aug 1, 2024

These are manual test, yes.

#354 (comment)

Copy link
Member

@jmezach jmezach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jmezach
Copy link
Member

jmezach commented Aug 2, 2024

Hi @ErikEJ,

I hope you don't mind, but I'm encountering some issues. I created a codespace with your branch and ran dotnet build on the test project, but I'm still seeing build errors. Could you help me figure out what I might be doing wrong?

Thanks! Screenshot 2024-08-01 at 10 19 12 AM

What branch are you on, I couldn't see that from the screenshot. Looks like an older version somehow. We've had support for .NET 8 for quite a while now.

@ErikEJ
Copy link
Collaborator Author

ErikEJ commented Aug 2, 2024

@jmezach @jeffrosenberg

Thanks! The verifies that GenerateCreateScript works with an external "master" dacpac reference.

It did require setting DatabaseVariableLiteralValue="master"

If this was NOT set, the following error happended:

1>Unhandled exception. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
1> ---> System.NullReferenceException: Object reference not set to an instance of an object.
1>   at Microsoft.Data.Tools.Schema.Sql.SchemaModel.SqlScriptDomGenerator.CreateStatementGenerator.GenerateCreateAggregateStatement(IModelElement modelElement)
1>   at Microsoft.Data.Tools.Schema.Sql.SchemaModel.SqlScriptDomGenerator.CreateStatementGenerator.GenerateStatement(IModelElement modelElement)
1>   at Microsoft.Data.Tools.Schema.Sql.SchemaModel.SqlScriptDomGenerator.TryGenerateScriptDom(IModelElement element, ScriptDomOperation operation, TSqlScript& script)
1>   at Microsoft.Data.Tools.Schema.Sql.SchemaModel.SqlScriptDomGenerator.GenerateScriptDom(IModelElement element, ScriptDomOperation operation)
1>   at Microsoft.Data.Tools.Schema.Sql.Deployment.SqlDeploymentPlanGenerator.DeploymentScriptDomGenerator.GenerateFragment(Int32 operation, IModelElement element)
1>   at Microsoft.Data.Tools.Schema.Sql.Deployment.SqlDeploymentPlanGenerator.DeploymentScriptDomGenerator.GenerateSteps(Int32 operation, IModelElement element)
1>   at Microsoft.Data.Tools.Schema.Sql.Deployment.OrderedStepGenerator.Add(DeploymentScriptDomGenerator scriptDom, IModelElement element, Int32 operation)
1>   at Microsoft.Data.Tools.Schema.Sql.Deployment.Analyzers.PlanMediator.BuildDependencyOrderedSteps(Int32 operation, List`1 classOrder, List`1 operationOrder, Dictionary`2 changes, Boolean preserveGraphs, Dictionary`2& relating, Dictionary`2& related)
1>   at Microsoft.Data.Tools.Schema.Sql.Deployment.Analyzers.PlanMediator.BuildOperations()
1>   at Microsoft.Data.Tools.Schema.Sql.Deployment.SqlDeploymentPlanGenerator.OnGeneratePlan()
1>   at Microsoft.Data.Tools.Schema.Sql.Deployment.SqlDeploymentPlanGenerator.GeneratePlan(List`1 drops)
1>   at Microsoft.Data.Tools.Schema.Sql.Deployment.SqlDeployment.BuildPlan()
1>   at Microsoft.Data.Tools.Schema.Sql.Deployment.SqlDeployment.Controller.CreatePlan()
1>   at Microsoft.SqlServer.Dac.DacServices.<>c__DisplayClass55_0.<CreateDeploymentArtifactGenerationOperation>b__0(Object operation, CancellationToken token)
1>   at Microsoft.SqlServer.Dac.Operation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext context)
1>   at Microsoft.SqlServer.Dac.ReportMessageOperation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext context)
1>   at Microsoft.SqlServer.Dac.OperationExtension.Execute(IOperation operation, DacLoggingContext loggingContext, CancellationToken cancellationToken)
1>   at Microsoft.SqlServer.Dac.DacServices.GenerateCreateScript(Stream outputStream, DacPackage package, String targetDatabaseName, DacDeployOptions options)
1>   at MSBuild.Sdk.SqlProj.DacpacTool.PackageBuilder.GenerateCreateScript(FileInfo dacpacFile, String databaseName, DacDeployOptions deployOptions) in C:\Code\Github\MSBuild.Sdk.SqlProj\src\DacpacTool\PackageBuilder.cs:line 407
1>   at MSBuild.Sdk.SqlProj.DacpacTool.Program.BuildDacpac(BuildOptions options) in C:\Code\Github\MSBuild.Sdk.SqlProj\src\DacpacTool\Program.cs:line 199
1>   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
1>   at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)
1>   --- End of inner exception stack trace ---
1>   at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)
1>   at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
1>   at System.Delegate.DynamicInvokeImpl(Object[] args)
1>   at System.CommandLine.NamingConventionBinder.ModelBindingCommandHandler.InvokeAsync(InvocationContext context)
1>   at System.CommandLine.Parsing.ParseResultExtensions.InvokeAsync(ParseResult parseResult, IConsole console)
1>   at MSBuild.Sdk.SqlProj.DacpacTool.Program.Main(String[] args) in C:\Code\Github\MSBuild.Sdk.SqlProj\src\DacpacTool\Program.cs:line 80
1>   at MSBuild.Sdk.SqlProj.DacpacTool.Program.<Main>(String[] args)

@ErikEJ
Copy link
Collaborator Author

ErikEJ commented Aug 2, 2024

Wonder if I should update the section about system databases with this?

<ItemGroup>
        <PackageReference Include="Microsoft.SqlServer.Dacpacs.Master" Version="160.2.1" DacpacName="master" DatabaseVariableLiteralValue="master" />
</ItemGroup>

@jmezach
Copy link
Member

jmezach commented Aug 2, 2024

Yeah, I think that is a good idea. Kind of a weird exception though.

@ErikEJ
Copy link
Collaborator Author

ErikEJ commented Aug 2, 2024

@jmezach I updated the readme

@jmezach
Copy link
Member

jmezach commented Aug 2, 2024

I guess this PR needs the same changes as #598 for the pipeline to work again. Might want to merge that one first and then rebase this on top.

@ErikEJ
Copy link
Collaborator Author

ErikEJ commented Aug 2, 2024

Might want to merge that one first and then rebase this on top.

Yes, that was my plan...

@ErikEJ
Copy link
Collaborator Author

ErikEJ commented Aug 2, 2024

@jmezach Build unbroken 🎉

@jmezach
Copy link
Member

jmezach commented Aug 2, 2024

Nice. I think we can merge this. Doesn't really affect the product itself.

@ErikEJ
Copy link
Collaborator Author

ErikEJ commented Aug 2, 2024

Still waiting for the second approver...

@ErikEJ ErikEJ merged commit bbe8c4c into rr-wfm:master Aug 2, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants