Commit e7002c0
committed
Handle assembly loading errors at composition time
The default implementation of MEF's DirectoryCatalog does not
handle ReflectionTypeLoadExceptions that occur when assemblies
in the specified directory are loaded. This causes the full
assembly loading process to stop, meaning that no rules will
be found. When running Script Analyzer in a folder with a lot
of DLLs, this type of error becomes more likely. This change
introduces a new SafeDirectoryCatalog type which is more resilient
to this problem.
Also, there is a check that determines whether any rules have
been loaded before continuing. This check was prone to throwing
NullReferenceExceptions when MEF composition fails. I changed
that logic to be more resilient to potential null values.1 parent 30f3d0f commit e7002c0
File tree
3 files changed
+92
-9
lines changed- Engine
3 files changed
+92
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
357 | 357 | | |
358 | 358 | | |
359 | 359 | | |
| 360 | + | |
360 | 361 | | |
361 | | - | |
362 | | - | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
363 | 366 | | |
364 | 367 | | |
365 | 368 | | |
366 | | - | |
| 369 | + | |
367 | 370 | | |
368 | 371 | | |
369 | 372 | | |
| |||
411 | 414 | | |
412 | 415 | | |
413 | 416 | | |
414 | | - | |
415 | | - | |
416 | | - | |
417 | 417 | | |
418 | 418 | | |
419 | 419 | | |
420 | 420 | | |
421 | 421 | | |
422 | | - | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
423 | 425 | | |
424 | 426 | | |
425 | 427 | | |
426 | 428 | | |
427 | 429 | | |
428 | 430 | | |
429 | | - | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
430 | 435 | | |
431 | 436 | | |
432 | 437 | | |
| |||
438 | 443 | | |
439 | 444 | | |
440 | 445 | | |
441 | | - | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
442 | 450 | | |
443 | 451 | | |
444 | 452 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| 74 | + | |
74 | 75 | | |
75 | 76 | | |
76 | 77 | | |
| |||
0 commit comments