Skip to content

Commit

Permalink
v1.4.0-beta.8
Browse files Browse the repository at this point in the history
- fixed occasional "collection was modified" error when building the modules list
- testing update system after fix introduced in beta.7
  • Loading branch information
genemars committed Jan 7, 2023
1 parent ec02143 commit 31d82ec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/HomeGenie/Data/Module.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ public Module()
Stores = new TsList<Store>();
}

public Module Clone()
{
return (Module)MemberwiseClone();
}

}
}

4 changes: 2 additions & 2 deletions src/HomeGenie/Service/Utility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public static class SerializationExtensions
public static T DeepClone<T>(this T source)
{
// Don't serialize a null object, simply return the default for that object
if (Object.ReferenceEquals(source, null))
if (ReferenceEquals(source, null))
{
return default(T);
}
Expand Down Expand Up @@ -250,7 +250,7 @@ public static string Module2Json(Module module, bool hideProperties)
var resolver = new IgnorePropertyContractResolver(new List<string>{ "Properties" });
settings.ContractResolver = resolver;
}
return JsonConvert.SerializeObject(module, settings);
return JsonConvert.SerializeObject(module.Clone(), settings);
}

public static string JsonEncode(string fieldValue)
Expand Down

0 comments on commit 31d82ec

Please sign in to comment.