public bool PosTest1()
    {
        bool retVal = true;

        const string c_TEST_ID = "P001";
        string c_TEST_DESC = "PosTest1: initialize an instance of type AmbiguousMatchException via default constructor";
        string errorDesc;

        TestLibrary.TestFramework.BeginScenario(c_TEST_DESC);
        try
        {
            AmbiguousMatchException e = new AmbiguousMatchException();
            if (null == e)
            {
                errorDesc = "Failed to initialize an instance of type AmbiguousMatchException via default constructor.";
                TestLibrary.TestFramework.LogError("001" + " TestId-" + c_TEST_ID, errorDesc);
                retVal = false;
            }
        }
        catch (Exception e)
        {
            errorDesc = "Unexpected exception: " + e;
            TestLibrary.TestFramework.LogError("002" + " TestId-" + c_TEST_ID, errorDesc);
            retVal = false;
        }

        return retVal;
    }
		public void ConstructorWithMessageAndInnerExceptionWorks() {
			var inner = new Exception("a");
			var ex = new AmbiguousMatchException("The message", inner);
			Assert.IsTrue((object)ex is AmbiguousMatchException, "is AmbiguousMatchException");
			Assert.IsTrue(ReferenceEquals(ex.InnerException, inner), "InnerException");
			Assert.AreEqual(ex.Message, "The message");
		}
    public bool PosTest1()
    {
        bool retVal = true;

        const string c_TEST_ID = "P001";
        string c_TEST_DESC = "PosTest1: initialize an instance of type AmbiguousMatchException using an emtpy string message";
        string errorDesc;

        string message = string.Empty;
        Exception innerException = new ArgumentNullException();

        TestLibrary.TestFramework.BeginScenario(c_TEST_DESC);
        try
        {
            AmbiguousMatchException e = new AmbiguousMatchException(message, innerException);
            if (null == e || e.Message != message || e.InnerException != innerException)
            {
                errorDesc = "Failed to initialize an instance of type AmbiguousMatchException.";
                errorDesc += "\nInput message is emtpy string";
                errorDesc += "\nInner exception is " + innerException;
                TestLibrary.TestFramework.LogError("001" + " TestId-" + c_TEST_ID, errorDesc);
                retVal = false;
            }
        }
        catch (Exception e)
        {
            errorDesc = "Unexpected exception: " + e;
            errorDesc += "\nInput message is emtpy string";
            errorDesc += "\nInner exception is " + innerException;
            TestLibrary.TestFramework.LogError("002" + " TestId-" + c_TEST_ID, errorDesc);
            retVal = false;
        }

        return retVal;
    }
		public void TypePropertiesAreCorrect() {
			Assert.AreEqual(typeof(AmbiguousMatchException).FullName, "ss.AmbiguousMatchException", "Name");
			Assert.IsTrue(typeof(AmbiguousMatchException).IsClass, "IsClass");
			Assert.AreEqual(typeof(AmbiguousMatchException).BaseType, typeof(Exception), "BaseType");
			object d = new AmbiguousMatchException();
			Assert.IsTrue(d is AmbiguousMatchException, "is AmbiguousMatchException");
			Assert.IsTrue(d is Exception, "is Exception");

			var interfaces = typeof(AmbiguousMatchException).GetInterfaces();
			Assert.AreEqual(interfaces.Length, 0, "Interfaces length");
		}
        public sealed override bool Bind(RuntimeAssemblyName refName, bool cacheMissedLookups, out AssemblyBindResult result, out Exception exception)
        {
            bool foundMatch = false;

            result    = default(AssemblyBindResult);
            exception = null;

            Exception preferredException = null;

            foreach (KeyValuePair <RuntimeAssemblyName, ScopeDefinitionGroup> group in ScopeGroups)
            {
                if (AssemblyNameMatches(refName, group.Key, ref preferredException))
                {
                    if (foundMatch)
                    {
                        exception = new AmbiguousMatchException();
                        return(false);
                    }

                    foundMatch = true;
                    ScopeDefinitionGroup scopeDefinitionGroup = group.Value;

                    result.Reader = scopeDefinitionGroup.CanonicalScope.Reader;
                    result.ScopeDefinitionHandle = scopeDefinitionGroup.CanonicalScope.Handle;
                    result.OverflowScopes        = scopeDefinitionGroup.OverflowScopes;
                }
            }

            BindEcmaAssemblyName(refName, cacheMissedLookups, ref result, ref exception, ref preferredException, ref foundMatch);
            if (exception != null)
            {
                return(false);
            }

            if (!foundMatch)
            {
                exception = preferredException ?? new FileNotFoundException(SR.Format(SR.FileNotFound_AssemblyNotFound, refName.FullName));
                return(false);
            }

            return(true);
        }
        public void CheckpointStoreIsUsedByGetCheckpointAsync()
        {
            using var cancellationSource = new CancellationTokenSource();

            var expectedException   = new AmbiguousMatchException();
            var partitionId         = "fakePart";
            var mockCheckpointStore = new Mock <CheckpointStore>();
            var mockProcessor       = new MockCheckpointStoreProcessor(mockCheckpointStore.Object, 100, "fakeConsumer", "fakeNamespace", "fakeHub", Mock.Of <TokenCredential>());

            mockCheckpointStore
            .Setup(store => store.GetCheckpointAsync(
                       mockProcessor.FullyQualifiedNamespace,
                       mockProcessor.EventHubName,
                       mockProcessor.ConsumerGroup,
                       partitionId,
                       cancellationSource.Token))
            .ThrowsAsync(expectedException);

            Assert.That(async() => await mockProcessor.InvokeGetCheckpointAsync(partitionId, cancellationSource.Token), Throws.Exception.EqualTo(expectedException));
        }
        partial void BindEcmaAssemblyName(RuntimeAssemblyName refName, ref AssemblyBindResult result, ref Exception exception, ref bool foundMatch)
        {
            lock (s_ecmaLoadedAssemblies)
            {
                for (int i = 0; i < s_ecmaLoadedAssemblies.Count; i++)
                {
                    PEInfo info = s_ecmaLoadedAssemblies[i];
                    if (AssemblyNameMatches(refName, info.Name))
                    {
                        if (foundMatch)
                        {
                            exception = new AmbiguousMatchException();
                            return;
                        }

                        foundMatch = true;
                        result.EcmaMetadataReader = info.Reader;
                    }
                }
            }
        }
Beispiel #8
0
        public sealed override bool Bind(AssemblyName refName, out MetadataReader reader, out ScopeDefinitionHandle scopeDefinitionHandle, out IEnumerable <QScopeDefinition> overflowScopes, out Exception exception)
        {
            bool foundMatch = false;

            reader = null;
            scopeDefinitionHandle = default(ScopeDefinitionHandle);
            exception             = null;
            overflowScopes        = null;

            foreach (KeyValuePair <string, ScopeDefinitionGroup> group in ScopeGroups)
            {
                AssemblyName defName = new AssemblyName(group.Key);
                if (AssemblyNameMatches(refName, defName))
                {
                    if (foundMatch)
                    {
                        exception = new AmbiguousMatchException();
                        return(false);
                    }

                    foundMatch = true;
                    ScopeDefinitionGroup scopeDefinitionGroup = group.Value;

                    reader = scopeDefinitionGroup.CanonicalScope.Reader;
                    scopeDefinitionHandle = scopeDefinitionGroup.CanonicalScope.Handle;
                    overflowScopes        = scopeDefinitionGroup.OverflowScopes;
                }
            }

            if (!foundMatch)
            {
                exception = new IOException(SR.Format(SR.FileNotFound_AssemblyNotFound, refName.FullName));
                return(false);
            }

            return(true);
        }
        public sealed override bool Bind(AssemblyName refName, out MetadataReader reader, out ScopeDefinitionHandle scopeDefinitionHandle, out IEnumerable<QScopeDefinition> overflowScopes, out Exception exception)
        {
            bool foundMatch = false;
            reader = null;
            scopeDefinitionHandle = default(ScopeDefinitionHandle);
            exception = null;
            overflowScopes = null;

            foreach (KeyValuePair<string, ScopeDefinitionGroup> group in ScopeGroups)
            {
                AssemblyName defName = new AssemblyName(group.Key);
                if (AssemblyNameMatches(refName, defName))
                {
                    if (foundMatch)
                    {
                        exception = new AmbiguousMatchException();
                        return false;
                    }

                    foundMatch = true;
                    ScopeDefinitionGroup scopeDefinitionGroup = group.Value;

                    reader = scopeDefinitionGroup.CanonicalScope.Reader;
                    scopeDefinitionHandle = scopeDefinitionGroup.CanonicalScope.Handle;
                    overflowScopes = scopeDefinitionGroup.OverflowScopes;
                }
            }

            if (!foundMatch)
            {
                exception = new IOException(SR.Format(SR.FileNotFound_AssemblyNotFound, refName.FullName));
                return false;
            }

            return true;
        }
    public bool PosTest3()
    {
        bool retVal = true;

        const string c_TEST_ID = "P003";
        string c_TEST_DESC = "PosTest3: initialize an instance of type AmbiguousMatchException using a null reference";
        string errorDesc;

        string message = null;
        Exception innerException = new Exception();

        TestLibrary.TestFramework.BeginScenario(c_TEST_DESC);
        try
        {
            AmbiguousMatchException e = new AmbiguousMatchException(message, innerException);
            if (null == e)
            {
                errorDesc = "Failed to initialize an instance of type AmbiguousMatchException.";
                errorDesc += "\nInput message is a null reference.";
                errorDesc += "\nInner exception is " + innerException;
                TestLibrary.TestFramework.LogError("005" + " TestId-" + c_TEST_ID, errorDesc);
                retVal = false;
            }
        }
        catch (Exception e)
        {
            errorDesc = "Unexpected exception: " + e;
            errorDesc += "\nInput message is a null reference.";
            errorDesc += "\nInner exception is " + innerException;
            TestLibrary.TestFramework.LogError("006" + " TestId-" + c_TEST_ID, errorDesc);
            retVal = false;
        }

        return retVal;
    }
        partial void BindEcmaAssemblyName(RuntimeAssemblyName refName, bool cacheMissedLookups, ref AssemblyBindResult result, ref Exception exception, ref Exception preferredException, ref bool foundMatch)
        {
            lock (s_ecmaLoadedAssemblies)
            {
                for (int i = 0; i < s_ecmaLoadedAssemblies.Count; i++)
                {
                    PEInfo info = s_ecmaLoadedAssemblies[i];
                    if (AssemblyNameMatches(refName, info.Name, ref preferredException))
                    {
                        if (foundMatch)
                        {
                            exception = new AmbiguousMatchException();
                            return;
                        }

                        result.EcmaMetadataReader = info.Reader;
                        foundMatch = result.EcmaMetadataReader != null;

                        // For failed matches, we will never be able to succeed, so return now
                        if (!foundMatch)
                        {
                            return;
                        }
                    }
                }

                if (!foundMatch)
                {
                    try
                    {
                        // Not found in already loaded list, attempt to source assembly from disk
                        foreach (string filePath in FilePathsForAssembly(refName))
                        {
                            FileStream ownedFileStream = null;
                            PEReader   ownedPEReader   = null;
                            try
                            {
                                if (!RuntimeAugments.FileExists(filePath))
                                {
                                    continue;
                                }

                                try
                                {
                                    ownedFileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read);
                                }
                                catch (System.IO.IOException)
                                {
                                    // Failure to open a file is not fundamentally an assembly load error, but it does indicate this file cannot be used
                                    continue;
                                }

                                ownedPEReader = new PEReader(ownedFileStream);
                                // FileStream ownership transferred to ownedPEReader
                                ownedFileStream = null;

                                if (!ownedPEReader.HasMetadata)
                                {
                                    continue;
                                }

                                MetadataReader reader = ownedPEReader.GetMetadataReader();
                                // Create AssemblyName from MetadataReader
                                RuntimeAssemblyName runtimeAssemblyName = reader.GetAssemblyDefinition().ToRuntimeAssemblyName(reader).CanonicalizePublicKeyToken();

                                // If assembly name doesn't match, it isn't the one we're looking for. Continue to look for more assemblies
                                if (!AssemblyNameMatches(refName, runtimeAssemblyName, ref preferredException))
                                {
                                    continue;
                                }

                                // This is the one we are looking for, add it to the list of loaded assemblies
                                PEInfo peinfo = new PEInfo(runtimeAssemblyName, reader, ownedPEReader);

                                s_ecmaLoadedAssemblies.Add(peinfo);

                                // At this point the PE reader is no longer owned by this code, but is owned by the s_ecmaLoadedAssemblies list
                                PEReader pe = ownedPEReader;
                                ownedPEReader = null;

                                ModuleList moduleList    = ModuleList.Instance;
                                ModuleInfo newModuleInfo = new EcmaModuleInfo(moduleList.SystemModule.Handle, pe, reader);
                                moduleList.RegisterModule(newModuleInfo);

                                foundMatch = true;
                                result.EcmaMetadataReader = peinfo.Reader;
                                break;
                            }
                            finally
                            {
                                if (ownedFileStream != null)
                                {
                                    ownedFileStream.Dispose();
                                }

                                if (ownedPEReader != null)
                                {
                                    ownedPEReader.Dispose();
                                }
                            }
                        }
                    }
                    catch (System.IO.IOException)
                    { }
                    catch (System.ArgumentException)
                    { }
                    catch (System.BadImageFormatException badImageFormat)
                    {
                        exception = badImageFormat;
                    }

                    // Cache missed lookups
                    if (cacheMissedLookups && !foundMatch)
                    {
                        PEInfo peinfo = new PEInfo(refName, null, null);
                        s_ecmaLoadedAssemblies.Add(peinfo);
                    }
                }
            }
        }
Beispiel #12
0
        private void UpdateActionTarget(object oldTarget, object newTarget)
        {
            MethodInfo targetMethodInfo = null;

            // If it's being set to the initial value, ignore it
            // At this point, we're executing the View's InitializeComponent method, and the ActionTarget hasn't yet been assigned
            // If they've opted to throw if the target is null, then this will cause that exception.
            // We'll just wait until the ActionTarget is assigned, and we're called again
            if (newTarget == View.InitialActionTarget)
            {
                return;
            }

            if (newTarget == null)
            {
                // If it's Enable or Disable we don't do anything - CanExecute will handle this
                if (this.TargetNullBehaviour == ActionUnavailableBehaviour.Throw)
                {
                    var e = new ActionTargetNullException(String.Format("ActionTarget on element {0} is null (method name is {1})", this.Subject, this.MethodName));
                    this.logger.Error(e);
                    throw e;
                }
                else
                {
                    this.logger.Info("ActionTarget on element {0} is null (method name is {1}), but NullTarget is not Throw, so carrying on", this.Subject, this.MethodName);
                }
            }
            else
            {
                BindingFlags bindingFlags;
                if (newTarget is Type newTargetType)
                {
                    bindingFlags = BindingFlags.Public | BindingFlags.Static;
                }
                else
                {
                    newTargetType = newTarget.GetType();
                    bindingFlags  = BindingFlags.Public | BindingFlags.Instance;
                }
                try
                {
                    targetMethodInfo = newTargetType.GetMethod(this.MethodName, bindingFlags);

                    if (targetMethodInfo == null)
                    {
                        this.logger.Warn("Unable to find{0} method {1} on {2}", newTarget is Type ? " static" : "", this.MethodName, newTargetType.Name);
                    }
                    else
                    {
                        this.AssertTargetMethodInfo(targetMethodInfo, newTargetType);
                    }
                }
                catch (AmbiguousMatchException e)
                {
                    var ex = new AmbiguousMatchException(String.Format("Ambiguous match for {0} method on {1}", this.MethodName, newTargetType.Name), e);
                    this.logger.Error(ex);
                    throw ex;
                }
            }

            this.TargetMethodInfo = targetMethodInfo;

            this.OnTargetChanged(oldTarget, newTarget);
        }
		public void ConstructorWithMessageWorks() {
			var ex = new AmbiguousMatchException("The message");
			Assert.IsTrue((object)ex is AmbiguousMatchException, "is AmbiguousMatchException");
			Assert.IsTrue(ex.InnerException == null, "InnerException");
			Assert.AreEqual(ex.Message, "The message");
		}
Beispiel #14
0
        public sealed override bool Bind(RuntimeAssemblyName refName, out AssemblyBindResult result, out Exception exception)
        {
            bool foundMatch = false;

            result    = default(AssemblyBindResult);
            exception = null;

            refName = refName.CanonicalizePublicKeyToken();

            // At least one real-world app calls Type.GetType() for "char" using the assembly name "mscorlib". To accomodate this,
            // we will adopt the desktop CLR rule that anything named "mscorlib" automatically binds to the core assembly.
            bool useMscorlibNameCompareFunc    = false;
            RuntimeAssemblyName compareRefName = refName;

            if (refName.Name == "mscorlib")
            {
                useMscorlibNameCompareFunc = true;
                compareRefName             = AssemblyNameParser.Parse(AssemblyBinder.DefaultAssemblyNameForGetType);
            }

            foreach (KeyValuePair <RuntimeAssemblyName, ScopeDefinitionGroup> group in ScopeGroups)
            {
                bool nameMatches;
                if (useMscorlibNameCompareFunc)
                {
                    nameMatches = MscorlibAssemblyNameMatches(compareRefName, group.Key);
                }
                else
                {
                    nameMatches = AssemblyNameMatches(refName, group.Key);
                }

                if (nameMatches)
                {
                    if (foundMatch)
                    {
                        exception = new AmbiguousMatchException();
                        return(false);
                    }

                    foundMatch = true;
                    ScopeDefinitionGroup scopeDefinitionGroup = group.Value;

                    result.Reader = scopeDefinitionGroup.CanonicalScope.Reader;
                    result.ScopeDefinitionHandle = scopeDefinitionGroup.CanonicalScope.Handle;
                    result.OverflowScopes        = scopeDefinitionGroup.OverflowScopes;
                }
            }

            BindEcmaAssemblyName(refName, ref result, ref exception, ref foundMatch);
            if (exception != null)
            {
                return(false);
            }

            if (!foundMatch)
            {
                exception = new IOException(SR.Format(SR.FileNotFound_AssemblyNotFound, refName.FullName));
                return(false);
            }

            return(true);
        }
        private void InvokeProcessRequestAsync <TRequestType, TResult>(TaskCompletionSource <TResult> taskProducer, StatefulServiceExecutionContext executionContext, string methodName, Tuple <Type, Type[], object[]> methodParams)
        {
            Exception exception = null;

            try
            {
                if (!typeof(IProcessHttpRequest).IsAssignableFrom(typeof(TRequestType)) &&
                    !typeof(IProcessTcpRequest).IsAssignableFrom(typeof(TRequestType)))
                {
                    taskProducer.SetException(new NotSupportedException("Method not supported by the server"));
                    return;
                }

                // Get Session Information
                StatefulProgramInstance instance = null;
                DateTime            expiryTime;
                IComparable         sessionId;
                object              sessionObj          = null;
                HttpListenerContext httpListenerContext = methodParams.Item3[methodParams.Item3.Length - 1] as HttpListenerContext;
                if (httpListenerContext != null)
                {
                    sessionObj = httpListenerContext.Request;
                }
                else
                {
                    // For TCP we smuggle the headers in IDictionary<string, string> passed via asyncState
                    StreamWrapper streamWrapper = methodParams.Item3[methodParams.Item3.Length - 1] as StreamWrapper;
                    sessionObj = streamWrapper != null ? streamWrapper.UserData : null;
                }

                if (!StatefulServiceReplica <TInstance> .GetSessionInformation(sessionObj, out sessionId, out expiryTime))
                {
                    // TODO: We do not support session expiry currently
                    sessionId  = Helpers.GenerateUniqueId();
                    expiryTime = DateTime.UtcNow.AddYears(100);
                }
                else
                {
                    instance = this.instanceManager.GetInstance(sessionId);
                }

                // Create a new instance if necessary
                bool setSessionInformation = false;
                bool isExpired             = sessionId != null && DateTime.UtcNow > expiryTime;
                if (instance == null)
                {
                    this.CreateInstance(sessionId, null);
                    instance = this.instanceManager.GetInstance(sessionId);
                    setSessionInformation = true;
                }

                Action <Task> processRequestContinuation = delegate(Task task)
                {
                    this.Invoke <StatefulServiceExecutionContext>(
                        (cec) =>
                    {
                        Exception exception1 = null;
                        try
                        {
                            if (setSessionInformation)
                            {
                                if (httpListenerContext != null)
                                {
                                    sessionObj = httpListenerContext.Response;
                                }
                                else
                                {
                                    // For TCP we smuggle the headers in asyncObject
                                    sessionObj = (IDictionary <string, string>)methodParams.Item3[methodParams.Item3.Length - 1];
                                }

                                StatefulServiceReplica <TInstance> .SetSessionInformation(sessionObj, sessionId, expiryTime);
                            }

                            if (!task.IsFaulted)
                            {
                                // Get the result from either the http task or task returned by Replicable method invocation.
                                object result = null;
                                if (typeof(IProcessTcpRequest).IsAssignableFrom(typeof(TRequestType)))
                                {
                                    Task <Stream> tcpResponseTask = task as Task <Stream>;
                                    if (tcpResponseTask != null)
                                    {
                                        result = tcpResponseTask.Result;
                                    }
                                    else
                                    {
                                        Task <object> taskWithObj = task as Task <object>;
                                        result = (Stream)taskWithObj.Result;
                                    }
                                }

                                taskProducer.SetResult((TResult)result);
                            }
                            else
                            {
                                exception1 = task.Exception.InnerException ?? task.Exception;
                            }

                            if (isExpired)
                            {
                                this.DeleteInstance(sessionId);
                            }
                        }
                        catch (Exception e)
                        {
                            AppTrace.TraceException(e, "StatefulServiceReplicaT.InvokeProcessRequestAsync");
                            exception1 = e;
                        }
                        finally
                        {
                            if (exception1 != null)
                            {
                                taskProducer.SetException(exception1);
                            }
                        }
                    });
                };

                if (instance != null && !isExpired)
                {
                    IEnumerable <ReplicableMethodInfo> matchingMethods = null;
                    instance.TypeInfo.TryGetMatchingMethod("ProcessRequestAsync", methodParams.Item1, methodParams.Item2, out matchingMethods);
                    int matchingMethodCount = matchingMethods != null?matchingMethods.Count() : 0;

                    if (matchingMethodCount == 1 && matchingMethods.First().Type == ReplicableMethodInfo.MethodType.AsyncTask)
                    {
                        ReplicableMethodInfo             methodInfo          = matchingMethods.First();
                        Task <Tuple <object, object[]> > asyncInvocationTask = instance.InvokeAsync(methodInfo.Methods[0], methodParams.Item3);
                        asyncInvocationTask.Wait();
                        Task task = (Task)asyncInvocationTask.Result.Item1;
                        task.ContinueWith(processRequestContinuation);
                    }
                    else if (matchingMethodCount > 1)
                    {
                        exception = new AmbiguousMatchException(String.Format(CultureInfo.InvariantCulture, "Multiple methods with name '{0}' matching similar parameters were found", "ProcessRequestAsync"));
                    }
                    else if (typeof(IProcessHttpRequest).IsAssignableFrom(typeof(TRequestType)))
                    {
                        ((IProcessHttpRequest)instance.Instance).ProcessRequestAsync((HttpListenerContext)methodParams.Item3[0])
                        .ContinueWith(task => { processRequestContinuation(task); }, TaskContinuationOptions.ExecuteSynchronously);
                    }
                    else
                    {
                        ((IProcessTcpRequest)instance.Instance).ProcessRequestAsync((Stream)methodParams.Item3[0])
                        .ContinueWith(task => { processRequestContinuation(task); }, TaskContinuationOptions.ExecuteSynchronously);
                    }
                }
                else
                {
                    AppTrace.TraceMsg(TraceLogEventType.Warning, "StatefulServiceReplicaT.InvokeProcessRequestAsync", "Instance cannot be created for expired session cookie with session id '{0}'.", sessionId);
                    taskProducer.SetException(new InvalidOperationException("Instance expired. Service cannot process request"));
                }
            }
            catch (Exception e)
            {
                AppTrace.TraceException(e, "StatefulServiceReplicaT.InvokeProcessRequestAsync");
                exception = e;
            }
            finally
            {
                if (exception != null)
                {
                    taskProducer.SetException(exception);
                }
            }
        }
    public bool PosTest2()
    {
        bool retVal = true;

        const string c_TEST_ID = "P002";
        string c_TEST_DESC = "PosTest2: initialize an instance of type AmbiguousMatchException using a string containing special character";
        string errorDesc;

        string message = "Not supported exception occurs here \n\r\0\t\v";
        Exception innerException = new Exception();

        TestLibrary.TestFramework.BeginScenario(c_TEST_DESC);
        try
        {
            AmbiguousMatchException e = new AmbiguousMatchException(message, innerException);
            if (null == e || e.Message != message || e.InnerException != innerException)
            {
                errorDesc = "Failed to initialize an instance of type AmbiguousMatchException.";
                errorDesc += "\nInput message is \"" + message + "\"";
                errorDesc += "\nInner exception is " + innerException;
                TestLibrary.TestFramework.LogError("003" + " TestId-" + c_TEST_ID, errorDesc);
                retVal = false;
            }
        }
        catch (Exception e)
        {
            errorDesc = "Unexpected exception: " + e;
            errorDesc += "\nInput message is \"" + message + "\"";
            errorDesc += "\nInner exception is " + innerException;
            TestLibrary.TestFramework.LogError("004" + " TestId-" + c_TEST_ID, errorDesc);
            retVal = false;
        }

        return retVal;
    }
		public void DefaultConstructorWorks() {
			var ex = new AmbiguousMatchException();
			Assert.IsTrue((object)ex is AmbiguousMatchException, "is AmbiguousMatchException");
			Assert.IsTrue(ex.InnerException == null, "InnerException");
			Assert.AreEqual(ex.Message, "Ambiguous match.");
		}