diff options
author | Sebastien Pouliot <sebastien@ximian.com> | 2009-12-09 06:20:08 +0300 |
---|---|---|
committer | Sebastien Pouliot <sebastien@ximian.com> | 2009-12-09 06:20:08 +0300 |
commit | c7e79cd73617536164d00e8f98aa60efebe3c45f (patch) | |
tree | 19c9b56ac0b83a3cc1371078d061e06096b98443 | |
parent | f6045f09bca0c4afe99b75e978f44b599fbaee0b (diff) |
2009-12-08 Sebastien Pouliot <sebastien@ximian.com>mono-2-6-rc1
* Wizard.cs: Don't throw/crash wizard if an unmanaged dll is
added to the list of assemblies. At the moment the assembly is
simply ignored.
[Backport r147897]
svn path=/branches/mono-2-6/mono-tools/; revision=147898
-rw-r--r-- | gendarme/swf-wizard-runner/ChangeLog | 7 | ||||
-rw-r--r-- | gendarme/swf-wizard-runner/Wizard.cs | 14 |
2 files changed, 19 insertions, 2 deletions
diff --git a/gendarme/swf-wizard-runner/ChangeLog b/gendarme/swf-wizard-runner/ChangeLog index e00f34f9..84183a64 100644 --- a/gendarme/swf-wizard-runner/ChangeLog +++ b/gendarme/swf-wizard-runner/ChangeLog @@ -1,3 +1,10 @@ +2009-12-08 Sebastien Pouliot <sebastien@ximian.com> + + * Wizard.cs: Don't throw/crash wizard if an unmanaged dll is + added to the list of assemblies. At the moment the assembly is + simply ignored. + [Backport r147897] + 2009-11-29 Sebastien Pouliot <sebastien@ximian.com> * GuiRunner.cs: Add Execute method that will catch and report diff --git a/gendarme/swf-wizard-runner/Wizard.cs b/gendarme/swf-wizard-runner/Wizard.cs index 5f735c9b..f154fbfd 100644 --- a/gendarme/swf-wizard-runner/Wizard.cs +++ b/gendarme/swf-wizard-runner/Wizard.cs @@ -37,6 +37,7 @@ using Gendarme.Framework; using Gendarme.Properties; using Mono.Cecil; +using Mono.Cecil.Binary; namespace Gendarme { @@ -323,7 +324,13 @@ namespace Gendarme { if ((kvp.Value.Definition == null) || (kvp.Value.Timestamp < last_write)) { AssemblyInfo a = kvp.Value; a.Timestamp = last_write; - a.Definition = AssemblyFactory.GetAssembly (kvp.Key); + try { + a.Definition = AssemblyFactory.GetAssembly (kvp.Key); + } + catch (ImageFormatException) { + // continue loading & analyzing assemblies + // TODO: report as non-fatal warning + } } } } @@ -540,7 +547,10 @@ namespace Gendarme { Runner.Assemblies.Clear (); foreach (KeyValuePair<string, AssemblyInfo> kvp in assemblies) { // add assemblies references to runner - Runner.Assemblies.Add (kvp.Value.Definition); + AssemblyDefinition ad = kvp.Value.Definition; + // an invalid assembly (e.g. non-managed code) will be null at this stage + if (ad != null) + Runner.Assemblies.Add (ad); } progress_bar.Maximum = Runner.Assemblies.Count; |