Hi,
- Can you share any of the multi-threading code?
It is hard to copy all code, it is too much.We have two windows, each one holds a map. They are loading in multi-threading by calling the method I post...
- Do you see the exception if only one thread is accessing the mobile map package?
I did not try with one thread on purpose..But even if I run it multi-threading, it does not happen every time...Sometimes, it happens 3 times in a row....Sometimes, I cannot see it once a whole day...And there is a strange thing, if the first time startup has this issue, mostly, the second time startup will be good. The multi-threading code has been used 3 months...I detect this issue in recent 3 weeks...Before, I did not notice this problem..
- What code runs in GetMaxScaleTask and GetMinScaleTask?
These two methods are simply retrieving a value from mmpk...
public async Task<double> GetMaxScaleTask()
{
string nameKey = KeyMaxScale;
var qryParams = new QueryParameters()
{
WhereClause = $"{GeoElementHelper.ColumnUName}='{nameKey}'",
ReturnGeometry = false,
};
var floorTable = GetTable(MapPackageTableTypes.settings);
var result = await floorTable.QueryFeaturesAsync(qryParams).ContinueWith(t => t.Result.FirstOrDefault());
if (null == result)
{
throw new InvalidOperationException(string.Format(Resources.Msg_NoKeyInMapPackage, KeyMaxScale));
}
return double.Parse(result.GetAttributeValue(GeoElementHelper.ColumnUValue1).ToString());
}
public async Task<double> GetMinScaleTask()
{
string nameKey = KeyMinScale;
var qryParams = new QueryParameters()
{
WhereClause = $"{GeoElementHelper.ColumnUName}='{nameKey}'",
ReturnGeometry = false,
};
var floorTable = GetTable(MapPackageTableTypes.settings);
Feature result = await floorTable.QueryFeaturesAsync(qryParams).ContinueWith(t => t.Result.FirstOrDefault());
if (null == result)
{
throw new InvalidOperationException(string.Format(Resources.Msg_NoKeyInMapPackage, KeyMinScale));
}
return double.Parse(result.GetAttributeValue(GeoElementHelper.ColumnUValue1).ToString());
}
**************************************************
- Can you try awaiting the Map.LoadAsync operation before attempting to set the MaxScale and MinScale?
- What happens if you remove the List parallelization?
I will try this...
And I have two questions..
1. Does the stack trace I copied provide some useful information?
2. Can you let me know if loading mmpk in multi-threading is safe?
Thanks...