File tree Expand file tree Collapse file tree 1 file changed +2
-4
lines changed
src/toolkit/Community.VisualStudio.Toolkit.Shared/Commands Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Original file line number Diff line number Diff line change 11using System ;
22using System . ComponentModel . Design ;
3- using System . Linq ;
3+ using System . Reflection ;
44using System . Threading . Tasks ;
55using Microsoft ;
66using Microsoft . VisualStudio . Shell ;
@@ -34,9 +34,7 @@ public static async Task<T> InitializeAsync(AsyncPackage package)
3434 {
3535 BaseCommand < T > instance = ( BaseCommand < T > ) ( object ) new T ( ) ;
3636
37- CommandAttribute ? attr = ( CommandAttribute ) instance . GetType ( ) . GetCustomAttributes ( typeof ( CommandAttribute ) , true ) . FirstOrDefault ( ) ;
38-
39- if ( attr is null )
37+ if ( instance . GetType ( ) . GetCustomAttribute ( typeof ( CommandAttribute ) ) is not CommandAttribute attr )
4038 {
4139 throw new InvalidOperationException ( $ "No [Command(GUID, ID)] attribute was added to { typeof ( T ) . Name } ") ;
4240 }
You can’t perform that action at this time.
0 commit comments