@@ -75,7 +75,7 @@ private static AnalyzeSchema CompileAnalyzer()
7575 Expression lazyExport = Expression . Field ( null , typeof ( SchemaAnalyzer ) , nameof ( LazyExport ) ) ;
7676 Type extensionDescriptorType = SchemaSqlAssembly . GetType ( "Microsoft.SqlServer.Dac.Extensibility.ExtensionDescriptor`2" , true )
7777 . MakeGenericType ( typeof ( SqlAnalysisRule ) , typeof ( ISqlAnalysisRuleMetadata ) ) ;
78- ConstructorInfo extensionDescriptorCtor = extensionDescriptorType . GetConstructor ( new [ ] { lazyExport . Type } ) ;
78+ ConstructorInfo extensionDescriptorCtor = extensionDescriptorType . GetConstructorSafe ( lazyExport . Type ) ;
7979 Guard . IsNotNull ( extensionDescriptorCtor , nameof ( extensionDescriptorCtor ) , "Could not find constructor on ExtensionDescriptor<,>" ) ;
8080 ParameterExpression extensionDescriptorVariable = Expression . Variable ( extensionDescriptorType , "extensionDescriptor" ) ;
8181 Expression extensionDescriptorValue = Expression . New ( extensionDescriptorCtor , lazyExport ) ;
@@ -84,15 +84,15 @@ private static AnalyzeSchema CompileAnalyzer()
8484 // RuleDescriptor ruleDescriptor = new RuleDescriptorImpl(extensionDescriptor);
8585 Type ruleDescriptorType = DacExtensionsAssembly . GetType ( "Microsoft.SqlServer.Dac.CodeAnalysis.RuleDescriptor" , true ) ;
8686 Type ruleDescriptorImplType = DacExtensionsAssembly . GetType ( "Microsoft.SqlServer.Dac.CodeAnalysis.Engine.RuleDescriptorImpl" , true ) ;
87- ConstructorInfo ruleDescriptorImplCtor = ruleDescriptorImplType . GetConstructor ( new [ ] { extensionDescriptorType } ) ;
87+ ConstructorInfo ruleDescriptorImplCtor = ruleDescriptorImplType . GetConstructorSafe ( extensionDescriptorType ) ;
8888 Guard . IsNotNull ( ruleDescriptorImplCtor , nameof ( ruleDescriptorImplCtor ) , "Could not find constructor on RuleDescriptorImpl" ) ;
8989 ParameterExpression ruleDescriptorVariable = Expression . Variable ( ruleDescriptorType , "ruleDescriptor" ) ;
9090 Expression ruleDescriptorValue = Expression . New ( ruleDescriptorImplCtor , extensionDescriptorVariable ) ;
9191 Expression ruleDescriptorAssign = Expression . Assign ( ruleDescriptorVariable , ruleDescriptorValue ) ;
9292
9393 // NullableColumnSchemaAnalyzer nullableColumnSchemaAnalyzer = new NullableColumnSchemaAnalyzer(ruleDescriptor, dataSchemaModel, modelElement);
9494 Type nullableColumnSchemaAnalyzerType = DacExtensionsAssembly . GetType ( "Microsoft.SqlServer.Dac.CodeAnalysis.Rules.Performance.NullableColumnSchemaAnalyzer" ) ;
95- ConstructorInfo nullableColumnSchemaAnalyzerCtor = nullableColumnSchemaAnalyzerType . GetConstructor ( new [ ] { ruleDescriptorType , TSqlModelType , TSqlObjectType } ) ;
95+ ConstructorInfo nullableColumnSchemaAnalyzerCtor = nullableColumnSchemaAnalyzerType . GetConstructorSafe ( ruleDescriptorType , TSqlModelType , TSqlObjectType ) ;
9696 Guard . IsNotNull ( nullableColumnSchemaAnalyzerCtor , nameof ( nullableColumnSchemaAnalyzerCtor ) , "Could not find constructor on NullableColumnSchemaAnalyzer" ) ;
9797 ParameterExpression nullableColumnSchemaAnalyzerVariable = Expression . Variable ( nullableColumnSchemaAnalyzerType , "nullableColumnSchemaAnalyzer" ) ;
9898 Expression nullableColumnSchemaAnalyzerValue = Expression . New ( nullableColumnSchemaAnalyzerCtor , ruleDescriptorVariable , dataSchemaModelParameter , modelElementParameter ) ;
@@ -208,7 +208,7 @@ private static void CompileSchemaAnalyzerResultsIterator(Expression resultVariab
208208
209209 // ElementLocation location = new ElementLocation(offset, elementDescriptor.Identifiers, elementAccessor);
210210 Type elementLocationType = typeof ( ElementLocation ) ;
211- ConstructorInfo elementLocationCtor = elementLocationType . GetConstructor ( new [ ] { typeof ( int ) , typeof ( IEnumerable < string > ) , elementAccessorType } ) ;
211+ ConstructorInfo elementLocationCtor = elementLocationType . GetConstructorSafe ( typeof ( int ) , typeof ( IEnumerable < string > ) , elementAccessorType ) ;
212212 Guard . IsNotNull ( elementLocationCtor , nameof ( elementLocationCtor ) , "Could not find constructor on ElementLocation" ) ;
213213 Expression identifiersProperty = Expression . Property ( elementDescriptorVariable , "Identifiers" ) ;
214214 ParameterExpression locationVariable = Expression . Variable ( elementLocationType , "location" ) ;
0 commit comments