@@ -121,12 +121,11 @@ private static dynamic activeProject()
121121
122122 foreach ( dynamic o in activeProjects )
123123 {
124- dynamic project = o . Object ;
125- if ( ! isVisualCppProject ( project ) )
124+ if ( ! isVisualCppProject ( o ) )
126125 {
127126 return null ;
128127 }
129- return project ;
128+ return o . Object ;
130129 }
131130
132131 return null ;
@@ -289,8 +288,8 @@ private void documentSaved(Document document)
289288 }
290289 try
291290 {
292- dynamic project = document . ProjectItem . ContainingProject . Object ;
293- if ( ! isVisualCppProject ( project ) )
291+ var kind = document . ProjectItem . ContainingProject . Kind ;
292+ if ( ! isVisualCppProject ( document . ProjectItem . ContainingProject . Kind ) )
294293 {
295294 return ;
296295 }
@@ -304,6 +303,7 @@ private void documentSaved(Document document)
304303 return ;
305304 }
306305
306+ dynamic project = document . ProjectItem . ContainingProject . Object ;
307307 SourceFile sourceForAnalysis = createSourceFile ( document . FullName , currentConfig , project ) ;
308308 if ( sourceForAnalysis == null )
309309 return ;
@@ -428,7 +428,7 @@ private List<ConfiguredFiles> getActiveSelections()
428428 project = selItem . Project ;
429429 }
430430
431- if ( project == null || ! isVisualCppProject ( project . Object ) )
431+ if ( project == null || ! isVisualCppProject ( project . Kind ) )
432432 {
433433 continue ;
434434 }
@@ -524,13 +524,14 @@ private void checkSelections()
524524
525525 private List < SourceFile > getProjectFiles ( Project p , Configuration currentConfig )
526526 {
527- dynamic project = p . Object ;
528- if ( ! isVisualCppProject ( project ) )
527+ if ( ! isVisualCppProject ( p . Kind ) )
529528 {
530529 System . Windows . MessageBox . Show ( "Only C++ projects can be checked." ) ;
531530 return null ;
532531 }
532+
533533 List < SourceFile > files = new List < SourceFile > ( ) ;
534+ dynamic project = p . Object ;
534535 dynamic projectFiles = project . Files ;
535536 foreach ( dynamic file in projectFiles )
536537 {
@@ -641,7 +642,8 @@ private void runAnalysis(List<ConfiguredFiles> configuredFiles, OutputWindowPane
641642
642643 private static SourceFile createSourceFile ( string filePath , Configuration targetConfig , dynamic project )
643644 {
644- Debug . Assert ( isVisualCppProject ( ( object ) project ) ) ;
645+ // TODO:
646+ //Debug.Assert(isVisualCppProject((object)project));
645647 try
646648 {
647649 var configurationName = targetConfig . ConfigurationName ;
@@ -680,9 +682,9 @@ private static SourceFile createSourceFile(string filePath, Configuration target
680682 }
681683 }
682684
683- private static bool isVisualCppProject ( object project )
685+ private static bool isVisualCppProject ( string kind )
684686 {
685- return implementsInterface ( project , "Microsoft.VisualStudio.VCProjectEngine.VCProject ") ;
687+ return kind . Equals ( "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942} ") ;
686688 }
687689
688690 private static bool implementsInterface ( object objectToCheck , String interfaceName )
0 commit comments