Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ protected internal sealed override string SerializeToString(WorkflowMarkupSerial
}
else
{
writer.WriteString(argType.FullName);
writer.WriteString(argType?.FullName ?? string.Empty);
}
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ internal void SerializeContents(WorkflowMarkupSerializationManager serialization
{
writer.WriteValue(obj);
}
// For Key properties, we don;t want to get the extended properties
// For Key properties, we don't want to get the extended properties
if (!dictionaryKey)
properties.AddRange(serializationManager.GetExtendedProperties(obj));
}
Expand Down Expand Up @@ -586,24 +586,18 @@ internal void SerializeContents(WorkflowMarkupSerializationManager serialization
}
}

if (properties != null)
foreach (PropertyInfo propInfo in properties)
{
foreach (PropertyInfo propInfo in properties)
{
// Do not serialize properties that have corresponding dynamic properties.
if (propInfo != null && !allProperties.ContainsKey(propInfo.Name))
allProperties.Add(propInfo.Name, propInfo);
}
// Do not serialize properties that have corresponding dynamic properties.
if (propInfo != null && !allProperties.ContainsKey(propInfo.Name))
allProperties.Add(propInfo.Name, propInfo);
}

if (events != null)
foreach (EventInfo eventInfo in events)
{
foreach (EventInfo eventInfo in events)
{
// Do not serialize events that have corresponding dynamic properties.
if (eventInfo != null && !allProperties.ContainsKey(eventInfo.Name))
allProperties.Add(eventInfo.Name, eventInfo);
}
// Do not serialize events that have corresponding dynamic properties.
if (eventInfo != null && !allProperties.ContainsKey(eventInfo.Name))
allProperties.Add(eventInfo.Name, eventInfo);
}

using (ContentProperty contentProperty = new(serializationManager, serializer, obj))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ public void CreateXmlWriter_WithInvalidType_ReturnsNull()
public void CreateXmlWriter_WithNull_ReturnsNull()
{
// Arrange
System.Diagnostics.Trace.Listeners.Clear();
object? nullOutput = null;

// Act
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public void ConvertFrom_UnescapesCommas()
string input = "handle\\,with\\,commas, normalHandle";

// Act
var result = _converter.ConvertFrom(null, CultureInfo.InvariantCulture, input) as ICollection<string>;
var result = _converter.ConvertFrom(null, CultureInfo.InvariantCulture, input) as ICollection<string> ?? Array.Empty<string>();

// Assert
Assert.NotNull(result);
Expand All @@ -201,7 +201,7 @@ public void ConvertFrom_TrimsWhitespace()
string input = " handle1 , handle2 ";

// Act
var result = _converter.ConvertFrom(null, CultureInfo.InvariantCulture, input) as ICollection<string>;
var result = _converter.ConvertFrom(null, CultureInfo.InvariantCulture, input) as ICollection<string> ?? Array.Empty<string>();

// Assert
Assert.NotNull(result);
Expand All @@ -217,7 +217,7 @@ public void ConvertFrom_HandlesNewlineDelimiters()
string input = "handle1\r\nhandle2\nhandle3";

// Act
var result = _converter.ConvertFrom(null, CultureInfo.InvariantCulture, input) as ICollection<string>;
var result = _converter.ConvertFrom(null, CultureInfo.InvariantCulture, input) as ICollection<string> ?? Array.Empty<string>();

// Assert
Assert.NotNull(result);
Expand All @@ -234,7 +234,7 @@ public void ConvertFrom_RemovesDuplicates()
string input = "handle1, handle2, handle1, handle3";

// Act
var result = _converter.ConvertFrom(null, CultureInfo.InvariantCulture, input) as ICollection<string>;
var result = _converter.ConvertFrom(null, CultureInfo.InvariantCulture, input) as ICollection<string> ?? Array.Empty<string>();

// Assert
Assert.NotNull(result);
Expand All @@ -248,7 +248,7 @@ public void ConvertFrom_SkipsEmptyEntries()
string input = "handle1, ,handle2, ";

// Act
var result = _converter.ConvertFrom(null, CultureInfo.InvariantCulture, input) as ICollection<string>;
var result = _converter.ConvertFrom(null, CultureInfo.InvariantCulture, input) as ICollection<string> ?? Array.Empty<string>();

// Assert
Assert.NotNull(result);
Expand Down