Skip to content

Commit

Permalink
Merge pull request #20 from Microsoft/netfx462
Browse files Browse the repository at this point in the history
Update Reference Source to .NET Framework 4.6.2
  • Loading branch information
richlander authored Aug 5, 2016
2 parents d925d87 + 1acafe2 commit 4fe4349
Show file tree
Hide file tree
Showing 210 changed files with 5,593 additions and 1,733 deletions.
67 changes: 67 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto

###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp

###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary

###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary

###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain

# Force bash scripts to always use lf line endings so that if a repo is accessed
# in Unix via a file share from Windows, the scripts will work.
*.sh text eol=lf
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,11 @@ protected override void OnRender(DrawingContext drawingContext)
trueLabelText = (string)virtualizingContainer.ModelItem.Properties["TrueLabel"].ComputedValue;
}

double pixelsPerDip = VisualTreeHelper.GetDpi(trueConnectionPoint).PixelsPerDip;
actualPoint = new Point(trueConnectionPoint.Location.X - origin.X, trueConnectionPoint.Location.Y - origin.Y);
FormattedText trueMarkerFormattedText = new FormattedText(trueLabelText, new System.Globalization.CultureInfo(textCulture),
this.FlowDirection, FlowchartDesigner.FlowElementCaptionTypeface, FlowchartDesigner.FlowNodeCaptionFontSize,
new SolidColorBrush(WorkflowDesignerColors.WorkflowViewElementCaptionColor));
new SolidColorBrush(WorkflowDesignerColors.WorkflowViewElementCaptionColor), pixelsPerDip);
actualPoint.Y += ConnectionPoint.DrawingLargeSide / 2;
actualPoint.X -= trueMarkerFormattedText.WidthIncludingTrailingWhitespace;

Expand Down Expand Up @@ -94,9 +95,10 @@ protected override void OnRender(DrawingContext drawingContext)
actualPoint = new Point(falseConnectionPoint.Location.X - origin.X, falseConnectionPoint.Location.Y - origin.Y);
actualPoint.Y += ConnectionPoint.DrawingLargeSide / 2;

double pixelsPerDip = VisualTreeHelper.GetDpi(falseConnectionPoint).PixelsPerDip;
FormattedText falseMarkerFormattedText = new FormattedText(falseLabelText, new System.Globalization.CultureInfo(textCulture),
this.FlowDirection, FlowchartDesigner.FlowElementCaptionTypeface, FlowchartDesigner.FlowNodeCaptionFontSize,
new SolidColorBrush(WorkflowDesignerColors.WorkflowViewElementCaptionColor));
new SolidColorBrush(WorkflowDesignerColors.WorkflowViewElementCaptionColor), pixelsPerDip);

DrawtWithTransform(
drawingContext,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ namespace Microsoft.Activities.Presentation.Xaml
using System;
using System.Activities;
using System.Activities.Debugger;
using System.Activities.DynamicUpdate;
using System.Activities.Presentation.View;
using System.Activities.Presentation.ViewState;
using System.Collections.Generic;
Expand All @@ -30,6 +31,18 @@ internal static class ViewStateXamlHelper
XamlDebuggerXmlReader.EndColumnName.MemberName
};

// These are used to discover that we have found a DynamicUpdateInfo.OriginalDefintion or OriginalActivityBuilder
// attached property member. We have "hardcoded" the *MemberName" here because DynamicUpdateInfo has the
// AttachableMemberIdentifier properties marked as private. But the DynamicUpdateInfo class itself is public,
// as are the Get and Set methods.
static readonly string DynamicUpdateOriginalDefinitionMemberName = "OriginalDefinition";
static readonly MethodInfo GetOriginalDefinition = typeof(DynamicUpdateInfo).GetMethod("GetOriginalDefinition");
static readonly MethodInfo SetOriginalDefinition = typeof(DynamicUpdateInfo).GetMethod("SetOriginalDefinition");

static readonly string DynamicUpdateOriginalActivityBuilderMemberName = "OriginalActivityBuilder";
static readonly MethodInfo GetOriginalActivityBuilder = typeof(DynamicUpdateInfo).GetMethod("GetOriginalActivityBuilder");
static readonly MethodInfo SetOriginalActivityBuilder = typeof(DynamicUpdateInfo).GetMethod("SetOriginalActivityBuilder");

// This method collects view state attached properties and generates a Xaml node stream
// with all view state information appearing within the ViewStateManager node.
// It is called when workflow definition is being serialized to string.
Expand Down Expand Up @@ -279,6 +292,22 @@ public static XamlReader ConvertViewStateToAttachedProperties(XamlReader inputRe
// Xaml member definition for IdRef. Used to identify existing IdRef properties in the input nodestream.
XamlMember idRefMember = new XamlMember(IdRef, GetIdRef, SetIdRef, inputReader.SchemaContext);

// These are used to ignore the IdRef members that are inside a DynamicUpdateInfo.OriginalDefinition/OriginalActivityBuilder attached property.
// We need to ignore these because if we don't, the IdRef values for the objects in the actual workflow defintion will be ignored because of the
// duplicate IdRef value. This causes problems with activity designers that depend on the ViewStateManager data to correctly display the workflow
// on the WorkflowDesigner canvas.
XamlMember originalDefinitionMember = new XamlMember(DynamicUpdateOriginalDefinitionMemberName, GetOriginalDefinition, SetOriginalDefinition, inputReader.SchemaContext);
XamlMember originalActivityBuilderMember = new XamlMember(DynamicUpdateOriginalActivityBuilderMemberName, GetOriginalActivityBuilder, SetOriginalActivityBuilder, inputReader.SchemaContext);

// insideOriginalDefintion gets set to true when we find a "StartMember" node for either of the above two attached properties.
// originalDefintionMemberCount gets incremented if we find any "StartMember" and insideOriginalDefinition is true.
// originalDefintionMemberCount gets decremented if we find any "EndMember" and insideOriginalDefintion is true.
// insideOriginalDefintion gets set to false when we find an "EndMember" and originalDefinitionMemberCount gets decremented to 0.
// If insideOriginalDefintion is true when we find an "IdRef" member, we do NOT add that IdRef to the idRefsSeen HashSet to avoid
// duplicates being defined by the IdRefs inside of the OriginalDefinition attached properties.
bool insideOriginalDefinition = false;
int originalDefinitionMemberCount = 0;

// Dictionary containing Ids and corresponding viewstate related
// attached property nodes. Populated by StripViewStateElement method.
Dictionary<string, XamlNodeList> viewStateInfo = null;
Expand Down Expand Up @@ -323,9 +352,21 @@ public static XamlReader ConvertViewStateToAttachedProperties(XamlReader inputRe
break;

case XamlNodeType.StartMember:
// If we find a StartMember for DynamicUpdateInfo.OriginalDefinition or OriginalActivityBuilder, remember that we are
// inside one of those. We don't want to "remember" IdRef values in the idRefsSeen HashSet while inside these attached properties.
if (workflowDefinition.Member.Equals(originalDefinitionMember) || workflowDefinition.Member.Equals(originalActivityBuilderMember))
{
insideOriginalDefinition = true;
}

if (insideOriginalDefinition)
{
originalDefinitionMemberCount++;
}

// Track when the reader enters IdRef. Skip writing the start
// node to the output nodelist until we check for duplicates.
if (workflowDefinition.Member.Equals(idRefMember))
else if (workflowDefinition.Member.Equals(idRefMember))
{
inIdRefMember = true;
skipWritingWorkflowDefinition = true;
Expand All @@ -341,38 +382,43 @@ public static XamlReader ConvertViewStateToAttachedProperties(XamlReader inputRe
case XamlNodeType.Value:
if (inIdRefMember)
{
string idRef = workflowDefinition.Value as string;
if (!string.IsNullOrWhiteSpace(idRef))
// We don't want to deal with the IdRef if we are inside a DynamicUpdateInfo.OriginalDefinition/OriginalActivityBuilder
// attached property.
if (!insideOriginalDefinition)
{
// If IdRef value is a duplicate then do not associate it with
// the stack frame (top of stack == activity node with IdRef member on it).
if (idRefsSeen.Contains(idRef))
{
stack.Peek().IdRef = null;
}
// If the IdRef value is unique then associate it with the
// stack frame and also write its value into the output nodestream.
else
string idRef = workflowDefinition.Value as string;
if (!string.IsNullOrWhiteSpace(idRef))
{
stack.Peek().IdRef = idRef;
idManager.UpdateMap(idRef);
idRefsSeen.Add(idRef);

if (shouldPassLineInfo)
// If IdRef value is a duplicate then do not associate it with
// the stack frame (top of stack == activity node with IdRef member on it).
if (idRefsSeen.Contains(idRef))
{
lineInfoComsumer.SetLineInfo(idRefLineNumber, idRefLinePosition);
stack.Peek().IdRef = null;
}
// If the IdRef value is unique then associate it with the
// stack frame and also write its value into the output nodestream.
else
{
stack.Peek().IdRef = idRef;
idManager.UpdateMap(idRef);
idRefsSeen.Add(idRef);

mergedNodeWriter.WriteStartMember(idRefMember);
if (shouldPassLineInfo)
{
lineInfoComsumer.SetLineInfo(idRefLineNumber, idRefLinePosition);
}

if (shouldPassLineInfo)
{
lineInfoComsumer.SetLineInfo(lineInfo.LineNumber, lineInfo.LinePosition);
}
mergedNodeWriter.WriteStartMember(idRefMember);

mergedNodeWriter.WriteValue(idRef);
if (shouldPassLineInfo)
{
lineInfoComsumer.SetLineInfo(lineInfo.LineNumber, lineInfo.LinePosition);
}

shouldWriteIdRefEndMember = true;
mergedNodeWriter.WriteValue(idRef);

shouldWriteIdRefEndMember = true;
}
}
}
// Don't need to write IdRef value into the output
Expand All @@ -382,9 +428,21 @@ public static XamlReader ConvertViewStateToAttachedProperties(XamlReader inputRe
break;

case XamlNodeType.EndMember:
// If we are inside an OriginalDefinition/OriginalActivityBuilder attached property,
// decrement the count and if it goes to zero, set insideOriginalDefintion to false
// because we just encountered the EndMember for it.
if (insideOriginalDefinition)
{
originalDefinitionMemberCount--;
if (originalDefinitionMemberCount == 0)
{
insideOriginalDefinition = false;
}
}

// Exit IdRef node. Skip writing the EndMember node, we would have done
// it as part of reading the IdRef value.
if (inIdRefMember)
if (inIdRefMember && !insideOriginalDefinition)
{
inIdRefMember = false;
skipWritingWorkflowDefinition = true;
Expand All @@ -401,6 +459,7 @@ public static XamlReader ConvertViewStateToAttachedProperties(XamlReader inputRe
mergedNodeWriter.WriteEndMember();
}
}

break;

case XamlNodeType.EndObject:
Expand Down Expand Up @@ -592,6 +651,7 @@ static XamlReader StripViewStateElement(XamlReader inputReader, out Dictionary<s
viewStateSourceLocationMap = null;
XamlNodeList strippedNodeList = new XamlNodeList(inputReader.SchemaContext);
XamlMember viewStateManager = new XamlMember(ViewStateManager, GetViewStateManager, SetViewStateManager, inputReader.SchemaContext);

using (XamlWriter strippedWriter = strippedNodeList.Writer)
{
IXamlLineInfo lineInfo = inputReader as IXamlLineInfo;
Expand All @@ -618,7 +678,7 @@ static XamlReader StripViewStateElement(XamlReader inputReader, out Dictionary<s

return strippedNodeList.GetReader();
}

// This method reads ViewStateManager nodes from the xaml nodestream and outputs that in the
// viewStateInfo dictionary. The input reader is positioned on the ViewStateManagerNode in the nodestream.
static void ReadViewStateInfo(XamlReader inputReader, out Dictionary<string, XamlNodeList> viewStateInfo, out Dictionary<string, SourceLocation> viewStateSourceLocationMap)
Expand Down Expand Up @@ -700,7 +760,11 @@ static void ReadViewState(XamlType viewStateType, XamlReader xamlReader, out str
}
}
}
else if (globalMemberLevel == 1 && !IsAttachablePropertyForConvert(xamlReader))
// The xamlReader.ReadSubtree and subsequent while loop to get the Id member
// has moved the xamlReader forward to the next member. We need to check to see
// if it is an Attached Property that we care about. If it isn't then we need to
// skip it and not put it in the resulting XamlNodeList.
if (globalMemberLevel == 1 && !IsAttachablePropertyForConvert(xamlReader))
{
skippingUnexpectedAttachedProperty = true;
}
Expand Down
14 changes: 14 additions & 0 deletions System.Activities/System/Activities/Hosting/WorkflowInstance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,20 @@ public abstract class WorkflowInstance
StackTrace abortStack;
#endif

static WorkflowInstance()
{
try
{
using (TelemetryEventSource eventSource = new TelemetryEventSource())
{
eventSource.V2Runtime();
}
}
catch
{
}
}

protected WorkflowInstance(Activity workflowDefinition)
: this(workflowDefinition, null)
{
Expand Down
2 changes: 1 addition & 1 deletion System.Activities/System/Activities/WorkflowApplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public sealed class WorkflowApplication : WorkflowInstance
IList<Handle> rootExecutionProperties;

IDictionary<XName, InstanceValue> instanceMetadata;

public WorkflowApplication(Activity workflowDefinition)
: this(workflowDefinition, (WorkflowIdentity)null)
{
Expand Down
Loading

0 comments on commit 4fe4349

Please sign in to comment.