From f3f7f4e649cbb31e5f51d7a1f104cd20a85f17fd Mon Sep 17 00:00:00 2001 From: Val Melamed Date: Fri, 5 Feb 2016 17:26:45 -0500 Subject: [PATCH] sync --- Aspects/Facilities/ExceptionPolicyProvider.cs | 18 +++ Aspects/Policies/CallTraceCallHandler.cs | 44 +++--- .../Ciphers/EncryptedKey/EncryptedKey.csproj | 3 + Aspects/SemanticVersion.Metadata.cs | 22 +++ Aspects/SemanticVersion.cs | 4 +- .../ExceptionShieldingErrorHandler.cs | 2 +- .../Behaviors/ValidatingParameterInspector.cs | 39 ++--- Aspects/Wcf/Behaviors/WcfContextUtilities.cs | 2 +- .../WebContentTypeMapperDefaultJson.cs | 2 +- Aspects/Wcf/Clients/InterceptorLightClient.cs | 55 +++++-- Aspects/Wcf/Clients/LightClient.cs | 51 +++++-- Aspects/Wcf/Clients/LightClientBase.cs | 79 +++++++--- Aspects/Wcf/CustomDataContext.cs | 137 ++++++++++++++---- .../Wcf/DataContracts/DataTransferObject.cs | 2 +- Aspects/Wcf/FaultContracts/BusinessFault.cs | 2 +- Aspects/Wcf/FaultContracts/Fault.cs | 45 +++--- Aspects/Wcf/FaultContracts/IOFault.cs | 2 +- .../FaultContracts/InvalidOperationFault.cs | 2 +- .../FaultContracts/Metadata/FaultMetadata.cs | 9 +- .../ProtocolExceptionToWebFaultResolver.cs | 80 ++++++++++ .../ServiceCallTraceCallHandler.cs | 6 +- Aspects/Wcf/vm.Aspects.Wcf.csproj | 1 + Aspects/vm.Aspects.csproj | 4 + 23 files changed, 478 insertions(+), 133 deletions(-) create mode 100644 Aspects/SemanticVersion.Metadata.cs create mode 100644 Aspects/Wcf/FaultContracts/ProtocolExceptionToWebFaultResolver.cs diff --git a/Aspects/Facilities/ExceptionPolicyProvider.cs b/Aspects/Facilities/ExceptionPolicyProvider.cs index 685a2aa..363aec9 100644 --- a/Aspects/Facilities/ExceptionPolicyProvider.cs +++ b/Aspects/Facilities/ExceptionPolicyProvider.cs @@ -2,7 +2,9 @@ using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.Contracts; +using System.Globalization; using System.Linq; +using System.Text; using Microsoft.Practices.EnterpriseLibrary.ExceptionHandling; using Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging; using Microsoft.Practices.ServiceLocation; @@ -154,8 +156,24 @@ public static ExceptionManager CreateExceptionManager() // add a new policy policyEntries[d.Key] = d.Value.ToList(); else + { + var duplicates = list.Intersect(d.Value).ToList(); + + if (duplicates.Any()) + { + var message = new StringBuilder( + string.Format( + CultureInfo.InvariantCulture, + "One of the exception policy providers brings duplicate exception entries to policy {0}:\n{1}", + d.Key, + string.Join("\n ", duplicates.Select(x => x.ExceptionType.FullName)))); + + throw new InvalidOperationException(message.ToString()); + } + // add the entries to the existing policy list.AddRange(d.Value); + } // create the exception manager var exceptionManager = new ExceptionManager( diff --git a/Aspects/Policies/CallTraceCallHandler.cs b/Aspects/Policies/CallTraceCallHandler.cs index d78a0d0..1d6019a 100644 --- a/Aspects/Policies/CallTraceCallHandler.cs +++ b/Aspects/Policies/CallTraceCallHandler.cs @@ -189,6 +189,16 @@ public IMethodReturn Invoke( #endregion #region Overridables + + /// + /// Creates the call data. + /// + /// CallData. + protected virtual CallData CreateCallData() + { + return new CallData(); + } + /// /// Creates and fills a new call data object with additional audit data about the call. /// @@ -200,7 +210,7 @@ protected virtual CallData GetCallData( Contract.Requires(input != null, nameof(input)); Contract.Ensures(Contract.Result() != null); - var callData = new CallData(); + var callData = CreateCallData(); if (IncludeCallStack) callData.CallStack = Environment.StackTrace; @@ -545,7 +555,7 @@ protected void DumpParameters( writer.Write("("); writer.Indent(2); - for (var i=0; i()); - } + { + var methodInfo = input.MethodBase as MethodInfo; + + if (methodInfo == null || methodInfo.ReturnType == typeof(void)) + return; + + writer.Write("RETURN VALUE: "); + methodReturn.ReturnValue.DumpText( + writer, + 2, + null, + methodInfo.ReturnTypeCustomAttributes + .GetCustomAttribute()); + } } } } diff --git a/Aspects/Security/Cryptography/Ciphers/EncryptedKey/EncryptedKey.csproj b/Aspects/Security/Cryptography/Ciphers/EncryptedKey/EncryptedKey.csproj index 76b1288..b161dde 100644 --- a/Aspects/Security/Cryptography/Ciphers/EncryptedKey/EncryptedKey.csproj +++ b/Aspects/Security/Cryptography/Ciphers/EncryptedKey/EncryptedKey.csproj @@ -256,6 +256,9 @@ vm.Aspects.Security.Cryptography.Ciphers + + +