So update operations are working when I locally deploy my azure mobile service. But after I've published it to Azure my app crashes when trying to update data. For example here's two classes of mine:
public class TestSet : EntityData
{
public TestSet()
{
this.TestPointAttempts = new List<TestPointAttempt>();
}
[StringLength(10)]
public string TestTeamType { get; set; }
public int FieldTeamNumber { get; set; }
public int? DispatchTeamNumber { get; set; }
[DefaultValue(0)]
public int TestSetCount { get; set; }
public string DiscrepancyTypeId { get; set; }
public virtual DiscrepancyType DiscrepancyType { get; set; }
public string DiscrepancyTestSetId { get; set; }
public decimal? BER { get; set; }
public decimal? SSI { get; set; }
public decimal? BERLat { get; set; }
public decimal? BERLong { get; set; }
public string TileId { get; set; }
public virtual Tile Tile { get; set; }
public string ScenarioId { get; set; }
public virtual Scenario Scenario { get; set; }
public virtual ICollection<TestPointAttempt> TestPointAttempts { get; set; }
}
public class TestPointAttempt : EntityData
{
[Required]
public int TestAttemptNumber { get; set; }
public bool? TalkIn { get; set; }
public bool? TalkOut { get; set; }
public decimal? DAQIn { get; set; }
public decimal? DAQOut { get; set; }
public decimal? LatIn { get; set; }
public decimal? LongIn { get; set; }
public decimal? LatOut { get; set; }
public decimal? LongOut { get; set; }
public string TestSetId { get; set; }
public virtual TestSet TestSet { get; set; }
}
I have 1:n relationships set up. It all looks good and new inserts work fine (both local and azure) but Updates don't work when I publish to azure. When it goes to update a TestPointAttempt the app crashes because of low memory errors. It starts gobbling up mbs rising from ~30mb to 1gb in about 5 seconds!!! I used some memory profiling tools and it occurs during deserialization in json.net. Here's my update code:
public async Task SaveTestSet(TestSet ts)
{
IsPending = true;
ErrorMessage = null;
try
{
var tpas = ts.TestPointAttempts;
foreach (var tpa in tpas)
{
await testPointAttemptTable.UpdateAsync(tpa);
}
}
catch (Exception ex)
{
ErrorMessage = ex.Message;
Console.WriteLine(ErrorMessage);
}
finally
{
IsPending = false;
}
}
I then used fiddler to look at the response and fiddler would crash too because the response was too big. So now I found out that the mobile service is responding with GIGs of data...but how? I don't even know where to start looking. I debugged the mobile service and the update seems to go through the TableController just fine but it's returning a lot of data....
Where do I start looking on the Mobile Service to see how/why it's returning so much data?