microsoft / microsoft/sqlmanagementobjects

Unable to create a default DataFile object on a ManagedInstance database

Open
#34 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
143
Forks
28
PR merge metrics
No merged PRs in 30d

Description

Run the following code snippet (tweak the connection string ("...") to point to a ManagedInstance server):

var dbname = "bugDB";
var srvconn = new ServerConnection(new SqlConnection("..."));
var srv3 = new SMO.Server(srvconn);
var db = new SMO.Database(srv3, dbname);
db.Create();
                
DataFile df = new DataFile(db.FileGroups[0], "MatteoDF"); 
df.Create();

It won't work.

If you set some properties on the DataFile object before the creation, it'll work.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the C# reproduction with a connection string targeting a Managed Instance, focusing on DataFile creation after db.Create(). Compare the failing default DataFile path with the case where properties are set before df.Create(), and use that behavior to identify the missing creation requirements. Done means the snippet creates the DataFile without manually setting those properties.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, sql
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.