File tree Expand file tree Collapse file tree 3 files changed +28
-5
lines changed
StaticAnalysis/BreakingChangeAttributesAnalyzer Expand file tree Collapse file tree 3 files changed +28
-5
lines changed Original file line number Diff line number Diff line change 12
12
// limitations under the License.
13
13
// ----------------------------------------------------------------------------------
14
14
15
+ #if ! NETSTANDARD
16
+ using Microsoft . WindowsAzure . Commands . Common . CustomAttributes ;
17
+ #endif
15
18
using StaticAnalysis . BreakingChangeAnalyzer ;
16
19
using System ;
17
20
using System . Collections . Generic ;
@@ -229,7 +232,13 @@ private void LogBreakingChangesInModule(BreakingChangeAttributesInModule moduleD
229
232
foreach ( BreakingChangeAttributesInCmdlet cmdletData in moduleData . CmdletList )
230
233
{
231
234
textForBreakingChangesInModule += string . Format ( BREAKING_CHANGE_CMDLET_HEADER_FORMAT_STRING , cmdletData . CmdletName ) ;
232
- }
235
+ #if ! NETSTANDARD
236
+ foreach ( GenericBreakingChangeAttribute attribute in cmdletData . BreakingChangeAttributes )
237
+ {
238
+ textForBreakingChangesInModule += attribute . GetBreakingChangeTextFromAttribute ( cmdletData . CmdletType , true ) + "\n \n " ;
239
+ }
240
+ #endif
241
+ }
233
242
234
243
//Now that we have the text, add it to the log file
235
244
logger . LogMessage ( textForBreakingChangesInModule ) ;
Original file line number Diff line number Diff line change 18
18
using System . Linq ;
19
19
using System . Reflection ;
20
20
using System . Management . Automation ;
21
+ #if ! NETSTANDARD
22
+ using Microsoft . WindowsAzure . Commands . Common . CustomAttributes ;
23
+ #endif
21
24
using Tools . Common . Extensions ;
22
25
23
26
namespace StaticAnalysis . BreakingChangeAttributesAnalyzer
@@ -37,6 +40,9 @@ public class BreakingChangeAttributesInCmdlet
37
40
{
38
41
public Type CmdletType { get ; set ; }
39
42
public string CmdletName { get ; set ; }
43
+ #if ! NETSTANDARD
44
+ public List < GenericBreakingChangeAttribute > BreakingChangeAttributes { get ; set ; }
45
+ #endif
40
46
}
41
47
42
48
public class CmdletBreakingChangeAttributeLoader : MarshalByRefObject
@@ -56,11 +62,19 @@ public BreakingChangeAttributesInModule GetModuleBreakingChangeAttributes(string
56
62
foreach ( var type in assembly . GetCmdletTypes ( ) )
57
63
{
58
64
var cmdlet = type . GetAttribute < CmdletAttribute > ( ) ;
65
+ #if ! NETSTANDARD
66
+ var attributes = type . GetAttributes < GenericBreakingChangeAttribute > ( ) ;
67
+
68
+ if ( attributes != null && ( attributes . Count ( ) > 0 ) ) { }
69
+ #endif
59
70
var cmdletMetadata = new BreakingChangeAttributesInCmdlet
60
71
{
61
72
CmdletType = type ,
62
- CmdletName = cmdlet . VerbName + "-" + cmdlet . NounName
63
- } ;
73
+ CmdletName = cmdlet . VerbName + "-" + cmdlet . NounName ,
74
+ #if ! NETSTANDARD
75
+ BreakingChangeAttributes = attributes . ToList ( )
76
+ #endif
77
+ } ;
64
78
65
79
results . Add ( cmdletMetadata ) ;
66
80
}
Original file line number Diff line number Diff line change @@ -73,10 +73,10 @@ public AssemblyMetadata GetReflectedAssemblyFromFile(string assemblyPath)
73
73
#else
74
74
return new AssemblyMetadata ( AssemblyLoadContext . Default . LoadFromAssemblyPath ( assemblyPath ) ) ;
75
75
}
76
- catch ( System . IO . FileLoadException ex ) when ( string . Equals ( ex . Message , "Assembly with same name is already loaded" ) )
76
+ catch ( System . IO . FileLoadException ex ) when ( ex != null && string . Equals ( ex . Message , "Assembly with same name is already loaded" ) )
77
77
{
78
78
var assemblyName = AssemblyLoadContext . GetAssemblyName ( assemblyPath ) ;
79
- var assembly = AppDomain . CurrentDomain . GetAssemblies ( ) . Where ( a => a . GetName ( ) . Name == assemblyName . Name ) . FirstOrDefault ( ) ;
79
+ var assembly = AppDomain . CurrentDomain . GetAssemblies ( ) . Where ( a => a . GetName ( ) . Name == assemblyName ? . Name ) . FirstOrDefault ( ) ;
80
80
if ( assembly != null )
81
81
{
82
82
result = new AssemblyMetadata ( assembly ) ;
You can’t perform that action at this time.
0 commit comments