Skip to content
Draft
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
3 changes: 2 additions & 1 deletion Magic.IndexedDb/Extensions/MagicJsInvoke.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ internal async Task CallInvokeVoidDefaultJsAsync(string modulePath, string funct

stream.Position = 0;

var streamRef = new DotNetStreamReference(stream);
using var streamRef = new DotNetStreamReference(stream);

// Send to JS
var responseStreamRef = await _jsModule.InvokeAsync<IJSStreamReference>("streamedJsHandler",
Expand All @@ -133,6 +133,7 @@ internal async Task CallInvokeVoidDefaultJsAsync(string modulePath, string funct
using var reader = new StreamReader(responseStream);

string jsonResponse = await reader.ReadToEndAsync();
await responseStreamRef.DisposeAsync();
return MagicSerializationHelper.DeserializeObject<T>(jsonResponse, settings);
}

Expand Down
3 changes: 2 additions & 1 deletion Magic.IndexedDb/Models/MagicContractResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,8 @@ private void WriteSimpleType(Utf8JsonWriter writer, object value)
switch (value)
{
case string str:
writer.WriteStringValue(str);
str = str.Replace("\"", "\\\"");
writer.WriteRawValue("\"" + str + "\"", true);
break;
case bool b:
writer.WriteBooleanValue(b);
Expand Down
2 changes: 1 addition & 1 deletion TestBase/Data/PersonData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public static class PersonData
{
public static Person[] persons =
[
new Person { _Id = 1, Name = "Zack", DateOfBirth = null, TestInt = 9, _Age = 45, GUIY = Guid.NewGuid(), DoNotMapTest = "I buried treasure behind my house", Access=Person.Permissions.CanRead},
new Person { _Id = 1, Name = "Zack", DateOfBirth = null, TestInt = 9, _Age = 45, GUIY = Guid.NewGuid(), DoNotMapTest = "I buried treasure behind my house", Access=Person.Permissions.CanRead, Secret = new String('a', 45000000)},
new Person { _Id = 2, Name = "Luna", TestInt = 9, DateOfBirth = new DateTime(1980, 1, 1), _Age = 35, GUIY = Guid.NewGuid(), DoNotMapTest = "Jerry is my husband and I had an affair with Bob.", Access = Person.Permissions.CanRead|Person.Permissions.CanWrite},
new Person { _Id = 3, Name = "Jerry", TestInt = 9, DateOfBirth = new DateTime(1981, 1, 1), _Age = 35, GUIY = Guid.NewGuid(), DoNotMapTest = "My wife is amazing", Access = Person.Permissions.CanRead|Person.Permissions.CanWrite|Person.Permissions.CanCreate},
new Person { _Id = 4, Name = "Jamie", TestInt = 9, DateOfBirth = new DateTime(1982, 1, 1), _Age = 35, GUIY = Guid.NewGuid(), DoNotMapTest = "My wife is amazing", Access = Person.Permissions.CanRead|Person.Permissions.CanWrite|Person.Permissions.CanCreate},
Expand Down
2 changes: 1 addition & 1 deletion TestWasm/Pages/Home.razor
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ IndexOrderingProperties = new List<Func<Person, object>> {


Person[] persons = new Person[] {
new Person { Name = "Zack", DateOfBirth = null, TestInt = 9, _Age = 45, GUIY = Guid.NewGuid(), DoNotMapTest = "I buried treasure behind my house", Access=Person.Permissions.CanRead},
new Person { Name = "Zack", DateOfBirth = null, TestInt = 9, _Age = 45, GUIY = Guid.NewGuid(), DoNotMapTest = "I buried treasure behind my house", Access=Person.Permissions.CanRead, Secret = new String('a', 45000000)},
new Person { Name = "Luna", TestInt = 9, DateOfBirth = GetDateWithSameMonthDay(GetRandomYear()), _Age = 35, GUIY = Guid.NewGuid(), DoNotMapTest = "Jerry is my husband and I had an affair with Bob.", Access = Person.Permissions.CanRead|Person.Permissions.CanWrite},
new Person { Name = "Jerry", TestInt = 9, DateOfBirth = GetDateWithSameMonthDay(GetRandomYear()), _Age = 35, GUIY = Guid.NewGuid(), DoNotMapTest = "My wife is amazing", Access = Person.Permissions.CanRead|Person.Permissions.CanWrite|Person.Permissions.CanCreate},
new Person { Name = "Jamie", TestInt = 9, DateOfBirth = GetDateWithSameMonthDay(GetRandomYear()), _Age = 35, GUIY = Guid.NewGuid(), DoNotMapTest = "My wife is amazing", Access = Person.Permissions.CanRead|Person.Permissions.CanWrite|Person.Permissions.CanCreate},
Expand Down