File tree Expand file tree Collapse file tree
StyleCop.Analyzers/StyleCop.Analyzers.Test/Helpers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,16 +26,25 @@ internal static class MetadataReferences
2626
2727 static MetadataReferences ( )
2828 {
29- Assembly systemRuntime = AppDomain . CurrentDomain . GetAssemblies ( ) . SingleOrDefault ( x => x . GetName ( ) . Name == "System.Runtime" ) ;
30- if ( systemRuntime != null )
29+ if ( typeof ( string ) . Assembly . GetType ( "System.ValueTuple" , false ) != null )
3130 {
32- SystemRuntimeReference = MetadataReference . CreateFromFile ( systemRuntime . Location ) ;
31+ // mscorlib contains ValueTuple, so no need to add a separate reference
32+ SystemRuntimeReference = null ;
33+ SystemValueTupleReference = null ;
3334 }
34-
35- Assembly systemValueTuple = AppDomain . CurrentDomain . GetAssemblies ( ) . SingleOrDefault ( x => x . GetName ( ) . Name == "System.ValueTuple" ) ;
36- if ( systemValueTuple != null )
35+ else
3736 {
38- SystemValueTupleReference = MetadataReference . CreateFromFile ( systemValueTuple . Location ) ;
37+ Assembly systemRuntime = AppDomain . CurrentDomain . GetAssemblies ( ) . SingleOrDefault ( x => x . GetName ( ) . Name == "System.Runtime" ) ;
38+ if ( systemRuntime != null )
39+ {
40+ SystemRuntimeReference = MetadataReference . CreateFromFile ( systemRuntime . Location ) ;
41+ }
42+
43+ Assembly systemValueTuple = AppDomain . CurrentDomain . GetAssemblies ( ) . SingleOrDefault ( x => x . GetName ( ) . Name == "System.ValueTuple" ) ;
44+ if ( systemValueTuple != null )
45+ {
46+ SystemValueTupleReference = MetadataReference . CreateFromFile ( systemValueTuple . Location ) ;
47+ }
3948 }
4049 }
4150 }
You can’t perform that action at this time.
0 commit comments