From e41907866441f27cad715c225b5e72baa64b674d Mon Sep 17 00:00:00 2001 From: NileshGhodekar Date: Fri, 14 Apr 2017 10:32:54 +0100 Subject: [PATCH] Instrumentation - Dumping function parameter values when a function throws an unhandled exception. --- ChangeLog.md | 4 +- src/VersionInfo.cs | 4 +- .../Common/ExpressionFunction.cs | 40 ++++++++++++++++++- 3 files changed, 43 insertions(+), 5 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index d1388b5..01897e9 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -7,11 +7,11 @@ All notable changes to MIMWAL project will be documented in this file. The "Unre * Support for multi-valued attributes in `[//Effective]` lookup in AuthZ workflows. * Implement Approve Request Activity. -### Version 2.17.0322.0 +### Version 2.17.0414.0 #### Added -* Support for executing SQL stored procedures and queries with the implementation of following new functions: +* Support for executing SQL stored procedures and queries for SQL Server and ODBC Data Sources with the implementation of following new functions: * New function [CreateSqlParameter][CreateSqlParameterFunction] * New function [CreateSqlParameter2][CreateSqlParameter2Function] * New function [ExecuteSqlNonQuery][ExecuteSqlNonQueryFunction] diff --git a/src/VersionInfo.cs b/src/VersionInfo.cs index 30fc039..6957d1b 100644 --- a/src/VersionInfo.cs +++ b/src/VersionInfo.cs @@ -22,7 +22,7 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary /// Build Number (MMDD) /// Revision (if any on the same day) /// - internal const string Version = "2.17.0322.0"; + internal const string Version = "2.17.0414.0"; /// /// File Version information for the assembly consists of the following four values: @@ -31,6 +31,6 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary /// Build Number (MMDD) /// Revision (if any on the same day) /// - internal const string FileVersion = "2.17.0322.0"; + internal const string FileVersion = "2.17.0414.0"; } } \ No newline at end of file diff --git a/src/WorkflowActivityLibrary/Common/ExpressionFunction.cs b/src/WorkflowActivityLibrary/Common/ExpressionFunction.cs index 8d3da73..e107a8e 100644 --- a/src/WorkflowActivityLibrary/Common/ExpressionFunction.cs +++ b/src/WorkflowActivityLibrary/Common/ExpressionFunction.cs @@ -350,7 +350,45 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Common } catch (Exception ex) { - throw Logger.Instance.ReportError(EventIdentifier.ExpressionFunctionRunUnknownFunctionExecutionError, new InvalidFunctionOperationException(Messages.ExpressionFunction_UnknownFunctionExecutionError, this.mode.ToString().ToLowerInvariant(), ex, this.function, ex.Message)); + // dump all function parameters in an error log entry + string paramString = string.Empty; + if (this.mode != EvaluationMode.Parse) + { + try + { + if (this.parameters != null && this.parameters.Count > 0) + { + for (var i = 0; i < this.parameters.Count; ++i) + { + var parameter = this.parameters[i]; + paramString += "'"; + if (parameter != null) + { + try + { + paramString += Convert.ToString(parameter) + "',"; + } + catch (Exception) + { + // let it print without the ending single quote as an indication of the conversion failure + } + } + else + { + paramString += "',"; + } + } + } + + paramString = "(" + paramString.TrimEnd(',') + ")"; + } + catch (Exception) + { + // do nothing - silenty ignore + } + } + + throw Logger.Instance.ReportError(EventIdentifier.ExpressionFunctionRunUnknownFunctionExecutionError, new InvalidFunctionOperationException(Messages.ExpressionFunction_UnknownFunctionExecutionError, this.mode.ToString().ToLowerInvariant(), ex, this.function + paramString, ex.Message)); } finally {