[Mono-bugs] [Bug 35004][Nor] Changed - Unhandled Exception: System.Reflection.AmbiguousMatchException: <element> has more than one attribute of type <attribute_type>

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
9 Dec 2002 16:41:39 -0000


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by james.birmingham@corp.terralycos.com.

http://bugzilla.ximian.com/show_bug.cgi?id=35004

--- shadow/35004	Mon Dec  9 11:15:24 2002
+++ shadow/35004.tmp.28727	Mon Dec  9 11:41:39 2002
@@ -141,6 +141,131 @@
 ------- Additional Comments From James.Birmingham@corp.terralycos.com  2002-12-09 11:15 -------
 We do not have any attributes in our code like [IndexerName ("XXX")] 
 so this is not the problem.  However, we do use indexers in a lot of 
 different places so I am hoping the code change you made will help me 
 to track it down.  I am rebuilding now.  I will let you know what I 
 find.
+
+------- Additional Comments From James.Birmingham@corp.terralycos.com  2002-12-09 11:41 -------
+Here is the code causing the problem.  We use this code to extract 
+script from an XML file and compile it at runtime.
+
+using System;
+using System.CodeDom.Compiler;
+using System.Collections.Specialized;
+using System.IO;
+using System.Reflection;
+using Microsoft.CSharp;
+
+public class Test
+{
+	public Test()
+	{
+		arguments = new CompilerParameters();
+		arguments.ReferencedAssemblies.Add("System.dll");
+		arguments.ReferencedAssemblies.Add("System.Web.dll");
+		arguments.ReferencedAssemblies.Add("System.Xml.dll");
+		arguments.CompilerOptions = new 
+System.CodeDom.Compiler.CompilerOptions();
+	}
+
+	public bool Compile()
+	{
+		assembly	= null;
+		errors		= "";
+		output		= "";
+		command		= "";
+
+		CodeDomProvider provider;
+		string code;
+
+		provider = new CSharpCodeProvider();
+		code =	"using System;" +
+				"using System.Collections;" +
+				"using 
+System.Collections.Specialized;" +
+				"using System.IO;" +
+				"using System.Text;" +
+				"using System.Web;" +
+				"using System.Xml;" +
+				"using System.Xml.XPath;" +
+				"using System.Xml.Xsl;" +
+				"using Lycos.Axis;" +
+				"using Lycos.Axis.Configuration;" +
+				"using Lycos.Axis.DataProviders;" +
+				"using Lycos.Axis.Logging;" +
+				"using Lycos.Axis.Utils;" +
+				"namespace Lycos.Axis.Internal.Code" +
+				"{" +
+				 sourceCode +
+				"}";
+
+		ICodeCompiler compiler = provider.CreateCompiler();
+
+		if (outputFileName != "")
+		{
+			arguments.OutputAssembly = outputFileName;
+		}
+
+		try
+		{
+			if (sourceCode != "")
+			{
+				results =
+				
+	compiler.CompileAssemblyFromSource(arguments, code);
+			}
+			else
+			{
+				results =
+				
+	compiler.CompileAssemblyFromFile
+						(arguments, fileName);
+			}
+			if (results.Errors.Count > 0)
+			{
+				for (int i = 0 ; i < 
+results.Errors.Count ; i++)
+				{
+					errors += results.Errors[i] 
++ "\n";
+				}
+			}
+			if (results.Output.Count > 0)
+			{
+				command = results.Output[0];
+				for (int i = 0 ; i < 
+results.Output.Count ; i++)
+				{
+					output += results.Output[i] 
++ "\n";
+				}
+			}
+		}
+		catch (Exception e)
+		{
+			errors = "Compiler exception:\n" + e.ToString
+() + errors;
+			return false;
+		}
+
+		return true;
+	}
+
+	private CompilerParameters		arguments;
+	private CompilerResults			results;
+	private Assembly				assembly;
+	private string					errors;
+	private string					output;
+	private string					fileName
+		= "";
+	private string					outputFileName
+	= "";
+	private string					sourceCode
+		= "";
+	private string					command	
+		= "";
+}
+
+BTW, I marked the bug as blocker because it was blocking me from 
+further testing.  If I am misinterpreting the priority system let me 
+know.