diff --git a/Analytics-CSharp/Analytics-CSharp.csproj b/Analytics-CSharp/Analytics-CSharp.csproj
index 72a439a..2cdde4c 100644
--- a/Analytics-CSharp/Analytics-CSharp.csproj
+++ b/Analytics-CSharp/Analytics-CSharp.csproj
@@ -10,7 +10,7 @@
Segment, Inc
The hassle-free way to add analytics to your C# app.
- 2.5.1
+ 2.5.3
MIT
https://github.com/segmentio/Analytics-CSharp
git
diff --git a/Analytics-CSharp/Segment/Analytics/Types.cs b/Analytics-CSharp/Segment/Analytics/Types.cs
index 5a67838..66cec72 100644
--- a/Analytics-CSharp/Segment/Analytics/Types.cs
+++ b/Analytics-CSharp/Segment/Analytics/Types.cs
@@ -1,6 +1,12 @@
using global::System;
using Segment.Serialization;
+#if NETSTANDARD2_0
+using System.Text.Json.Serialization;
+#else
+using Newtonsoft.Json;
+#endif
+
namespace Segment.Analytics
{
public class DestinationMetadata
@@ -18,6 +24,7 @@ public abstract class RawEvent
public virtual string UserId { get; set; }
public virtual string Timestamp { get; set; }
+ [JsonIgnore]
public Func Enrichment { get; set; }
// JSON types
diff --git a/Analytics-CSharp/Segment/Analytics/Version.cs b/Analytics-CSharp/Segment/Analytics/Version.cs
index 8889f46..9f34d6c 100644
--- a/Analytics-CSharp/Segment/Analytics/Version.cs
+++ b/Analytics-CSharp/Segment/Analytics/Version.cs
@@ -2,6 +2,6 @@ namespace Segment.Analytics
{
internal static class Version
{
- internal const string SegmentVersion = "2.5.1";
+ internal const string SegmentVersion = "2.5.3";
}
}
diff --git a/Tests/Utilities/StorageTest.cs b/Tests/Utilities/StorageTest.cs
index e8877d7..59ca670 100644
--- a/Tests/Utilities/StorageTest.cs
+++ b/Tests/Utilities/StorageTest.cs
@@ -254,6 +254,30 @@ public async Task TestStoreEvent()
Assert.Null(exception);
}
+ [Fact]
+ public async Task TestStoreEventWithEnrichment()
+ {
+ TrackEvent trackEvent = new TrackEvent("clicked", new JsonObject { ["foo"] = "bar" });
+ trackEvent.Enrichment = @event =>
+ {
+ return @event;
+ };
+ string payloadWithEnrichment = JsonUtility.ToJson(trackEvent);
+ await _storage.Write(StorageConstants.Events, payloadWithEnrichment);
+ await _storage.Rollover();
+
+ string path = _dir + Path.DirectorySeparatorChar + _writeKey + "-0.json";
+ string actual = File.ReadAllText(path);
+ Exception exception = Record.Exception(() =>
+ {
+ JsonUtility.FromJson(actual);
+ });
+
+ Assert.True(File.Exists(path));
+ Assert.Contains(_payload, actual);
+ Assert.Null(exception);
+ }
+
[Fact]
public async Task TestRead()
{