From ae692d51b7c9adea589aecfbf2c22c6c541509a8 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Sun, 13 Jul 2014 12:56:16 +0200 Subject: [PATCH] Fix #284 NotSupportedException thrown in NR CecilLoader --- .../ICSharpCode.NRefactory.Cecil/CecilLoader.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Cecil/CecilLoader.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Cecil/CecilLoader.cs index 92f642c2a9..123f810aa2 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Cecil/CecilLoader.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Cecil/CecilLoader.cs @@ -824,7 +824,13 @@ namespace ICSharpCode.NRefactory.TypeSystem void AddSecurityAttributes(SecurityDeclaration secDecl, IList targetCollection) { - var blobSecDecl = new UnresolvedSecurityDeclarationBlob((int)secDecl.Action, secDecl.GetBlob()); + byte[] blob; + try { + blob = secDecl.GetBlob(); + } catch (NotSupportedException) { + return; // https://github.com/icsharpcode/SharpDevelop/issues/284 + } + var blobSecDecl = new UnresolvedSecurityDeclarationBlob((int)secDecl.Action, blob); targetCollection.AddRange(blobSecDecl.UnresolvedAttributes); } #endregion