@@ -158,29 +158,34 @@ public static void ReadFromAttributes(this ExceptionlessConfiguration config, IC
158
158
159
159
assemblies = assemblies . Where ( a => a != null ) . Distinct ( ) . ToList ( ) ;
160
160
161
- foreach ( var assembly in assemblies ) {
162
- object [ ] attributes = assembly . GetCustomAttributes ( typeof ( ExceptionlessAttribute ) , false ) ;
163
- if ( attributes . Length <= 0 || ! ( attributes [ 0 ] is ExceptionlessAttribute ) )
164
- continue ;
165
-
166
- var attr = attributes [ 0 ] as ExceptionlessAttribute ;
167
-
168
- config . Enabled = attr . Enabled ;
169
-
170
- if ( ! String . IsNullOrEmpty ( attr . ApiKey ) && attr . ApiKey != "API_KEY_HERE" )
171
- config . ApiKey = attr . ApiKey ;
172
- if ( ! String . IsNullOrEmpty ( attr . ServerUrl ) )
173
- config . ServerUrl = attr . ServerUrl ;
174
-
175
- break ;
176
- }
161
+ try {
162
+ foreach ( var assembly in assemblies ) {
163
+ object [ ] attributes = assembly . GetCustomAttributes ( typeof ( ExceptionlessAttribute ) , false ) ;
164
+ if ( attributes . Length <= 0 || ! ( attributes [ 0 ] is ExceptionlessAttribute ) )
165
+ continue ;
166
+
167
+ var attr = attributes [ 0 ] as ExceptionlessAttribute ;
168
+
169
+ config . Enabled = attr . Enabled ;
170
+
171
+ if ( ! String . IsNullOrEmpty ( attr . ApiKey ) && attr . ApiKey != "API_KEY_HERE" )
172
+ config . ApiKey = attr . ApiKey ;
173
+ if ( ! String . IsNullOrEmpty ( attr . ServerUrl ) )
174
+ config . ServerUrl = attr . ServerUrl ;
175
+
176
+ break ;
177
+ }
177
178
178
- foreach ( var assembly in assemblies ) {
179
- object [ ] attributes = assembly . GetCustomAttributes ( typeof ( ExceptionlessSettingAttribute ) , false ) ;
180
- foreach ( ExceptionlessSettingAttribute attribute in attributes . OfType < ExceptionlessSettingAttribute > ( ) ) {
181
- if ( ! String . IsNullOrEmpty ( attribute . Name ) )
182
- config . Settings [ attribute . Name ] = attribute . Value ;
179
+ foreach ( var assembly in assemblies ) {
180
+ object [ ] attributes = assembly . GetCustomAttributes ( typeof ( ExceptionlessSettingAttribute ) , false ) ;
181
+ foreach ( ExceptionlessSettingAttribute attribute in attributes . OfType < ExceptionlessSettingAttribute > ( ) ) {
182
+ if ( ! String . IsNullOrEmpty ( attribute . Name ) )
183
+ config . Settings [ attribute . Name ] = attribute . Value ;
184
+ }
183
185
}
186
+ } catch ( Exception ex ) {
187
+ var log = config . Resolver . GetLog ( ) ;
188
+ log . Error ( ex , "Error while reading attribute configuration. Please contact support for more information." ) ;
184
189
}
185
190
}
186
191
}
0 commit comments