keif888 / SQLServerMetadata

SQL Server Metadata Toolkit
Microsoft Public License
82 stars 32 forks source link

Execute SQL Task with project connection manager fails #21

Closed nimearo closed 6 years ago

nimearo commented 6 years ago

When a package contains an "Execute SQL Task" which references a project connection manager SSISEnumerator fails on EnumerateSqlTask.

I tested it for packages targeting SSIS 2012 and received the stracktrace below when analyzing my SSIS source directory. SSIS project is in project deployment mode.

Stacktrace: Enumerating projects...done. Processing Project package 'XY'... Error The connection "{FD08C64A-...}" is not found. This error is thrown by Connections collection when the specific connection element is not found. occurred whilst attempting to handle ispac C:\Development.. With stack trace at Microsoft.SqlServer.Dts.Runtime.Connections.get_Item(Object index) at Microsoft.Samples.DependencyAnalyzer.SSISEnumerator.EnumerateSqlTask(Package package, String location, Int32 packageRepositoryID, TaskHost taskHost) in C:\Users\xy\Source\Repos\SQLServerMetadata\DependencyAnalyzer2008\SsisEnumerator.cs:line 1132 at Microsoft.Samples.DependencyAnalyzer.SSISEnumerator.EnumerateTask(Package package, String location, Int32 packageRepositoryID, DtsContainer dtsContainer) in C:\Users\xy\Source\Repos\SQLServerMetadata\DependencyAnalyzer2008\SsisEnumerator.cs:line 1062 at Microsoft.Samples.DependencyAnalyzer.SSISEnumerator.EnumerateTask(Package package, String location, Int32 packageRepositoryID, DtsContainer dtsContainer) in C:\Users\xy\Source\Repos\SQLServerMetadata\DependencyAnalyzer2008\SsisEnumerator.cs:line 1086 at Microsoft.Samples.DependencyAnalyzer.SSISEnumerator.EnumeratePackage(Package package, String location) in C:\Users\xy\Source\Repos\SQLServerMetadata\DependencyAnalyzer2008\SsisEnumerator.cs:line 1226 at Microsoft.Samples.DependencyAnalyzer.SSISEnumerator.EnumerateIntegrationServicePack(String integrationServicePack, String locationName) in C:\Users\xy\Source\Repos\SQLServerMetadata\DependencyAnalyzer2008\SsisEnumerator.cs:line 628. Committing analysis information to database...Completed.

keif888 commented 6 years ago

SQL 2012 doesn't read the connection's from the ispac, unlike more recent versions. Added code to read the names of the connection managers, which forces them to be loaded, and then available for analysis.

nimearo commented 6 years ago

Patch looks good and works for me