Thank you @ismcagdas
Items 2 and 3 are well explained. But, for item 1, it is still a mistery for me. Definitely, there is something different when using template 5.5 and 9.0.1. Maybe it is a parameters in the project that changes the HTML version or something like that. But, any way, as per W3C especification TextArea and Select are not self-closing tags, then we've changed all of them.
I am doing a migration from AspNetZero MVC/.Core JQuery version 5.5 to version 9.01 and I have found 3 issues that I cannot understand wy and in my point of view it is worst in the previous version. Can someone explain me why it has changed?
Before: <select id="create-visit-crew" class="form-control w-100" />
Now: <select id="create-visit-crew" class="form-control w-100"> </select>
This element is used to create a kendo.ui.dropdown, so, I don't need add options on the cshtml file. Using version 9.0.1 if I don't add the close tag it don't close the tag, however, on version 5.5 there is no problem doing that.
Object Mapper: Using version 5.5 some mappings there is no need to configure the map on CustomDtoMapper.cs file. But, on version 9.0.1, I had to configure all mappings objects (most of them are entity to dto). Is there some reason for that?
LINQ queries are not working as before: Some queries simplely doesn't work on the same estruture and are raising an exception suggesting to rewrite the query.
For example, this query:
var visitMaterialsUsedRecords = _materialRepository.GetAll() .Where(m => visitDto.TaskIds.Contains(m.TaskId.Value)) .GroupBy(m => m.MaterialTemplateId.Value) .Select(m => new VisitMaterialsUsed() { VisitId = visitDto.Id.Value, VisitReportId = report.Id, MaterialTemplateId = m.First().MaterialTemplateId.Value, Quantity = m.Sum(mt => mt.Quantity), OriginallyScheduled = true, }).ToList();
It is raising this exeption:
The LINQ expression '(GroupByShaperExpression: KeySelector: (int)(m.MaterialTemplateId), ElementSelector:(EntityShaperExpression: EntityType: Material ValueBufferExpression: (ProjectionBindingExpression: EmptyProjectionMember) IsNullable: False ) ) .First()' could not be translated. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call to either AsEnumerable(), AsAsyncEnumerable(), ToList(), or ToListAsync(). See https://go.microsoft.com/fwlink/?linkid=2101038 for more information.
So, I had to rewrite to this:
``var visitMaterialsUsedRecords = _materialRepository.GetAll() .Where(m => visitDto.TaskIds.Contains(m.TaskId.Value)).AsEnumerable();
var visitMaterialsUsed = visitMaterialsUsedRecords.GroupBy(m => m.MaterialTemplateId.Value)
.Select(m => new VisitMaterialsUsed()
{
VisitId = visitDto.Id.Value,
VisitReportId = report.Id,
MaterialTemplateId = m.First().MaterialTemplateId.Value,
Quantity = m.Sum(mt => mt.Quantity),
OriginallyScheduled = true,
}).ToList();``
Can some one explain why it has changed and what is wrong with the previous query?
Is there any update on plans to incorporate React?
Hi,
The Logger is not working in some situations. I wonder if someone else has the same problem and what I am missing to make it works.
Let me start explaining where I am using the Logger instance. I have a couple of classes that are instanced in the startup program and are used to read notifications from the database to update changes in my clients.
In these classes, I am creating a Logger instance to be able to catch exceptions and write down in the log file, as per the log4net.config configuration file. Those classes are located in the MVC project.
Basically, I have a local private property: private ILogger Logger { get; set; }
In the create method I assign this property like that: Logger = NullLogger.Instance;
and then writing the log like that: Logger.Error("Log Test ", ex);
My class is declared like that: public class AvaQueueHubService : ITransientDependency
And finally, creating an instance of my class in the Statup.cs, method Configure(), like that: _AvaQueueHubService = new AvaQueueHubService();
I tried to create the instance like that as well:
_CallLogHubService = serviceProvider.GetService<AvaQueueHubService>();
Does someone have any idea what I am missing?
Best regards!
Hi@ ismcagdas
I have implemented your sugestion and it is working fine. Now, I have my own class to Serializer. However, the error is still happening, but now, with the exception in my new class. Any idea how to resolve that?
ERROR 2019-04-10 21:32:01,450 [3 ] Abp.Runtime.Caching.Redis.AbpRedisCache - Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: S. Path '', line 0, position 0.
at Newtonsoft.Json.JsonTextReader.ParseValue()
at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
at TVD_Holdings_Ltd.Avalanche.Web.Core.Cache.RedisCacheSerializerEx.Deserialize(RedisValue objbyte) in D:\Source\AvalancheDashboard\AvalancheDashboard6.0\src\TVD_Holdings_Ltd.Avalanche.Web.Core\Cache\RedisCacheSerializerEx.cs:line 24
at Abp.Runtime.Caching.Redis.AbpRedisCache.Deserialize(RedisValue objbyte)
at Abp.Runtime.Caching.Redis.AbpRedisCache.GetOrDefault(String key)
at Abp.Runtime.Caching.CacheBase.GetOrDefaultAsync(String key)
at Abp.Runtime.Caching.CacheBase.GetAsync(String key, Func2 factory) Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: S. Path '', line 0, position 0. at Newtonsoft.Json.JsonTextReader.ParseValue() at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent) at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType) at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings) at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings) at TVD_Holdings_Ltd.Avalanche.Web.Core.Cache.RedisCacheSerializerEx.Deserialize(RedisValue objbyte) in D:\Source\AvalancheDashboard\AvalancheDashboard6.0\src\TVD_Holdings_Ltd.Avalanche.Web.Core\Cache\RedisCacheSerializerEx.cs:line 24 at Abp.Runtime.Caching.Redis.AbpRedisCache.Deserialize(RedisValue objbyte) at Abp.Runtime.Caching.Redis.AbpRedisCache.GetOrDefault(String key) at Abp.Runtime.Caching.CacheBase.GetOrDefaultAsync(String key) at Abp.Runtime.Caching.CacheBase.GetAsync(String key, Func
2 factory)
Hi @ismcagdas, thank you for your help. I had a read in that item, however, I was not able to implement something like that. Reasons:
I am using AspNetZero version 6.0 with .NET Core 2.1 MVC, maybe it is an important information.
Adding information.
I got the error, in sequence I run the TestAllCaches routine, but it seems be ok. So, It looks like if there is some exception retrieving information from cache, it is automatically cleaned. Does it make sense?
Exception:
ERROR 2019-04-05 02:00:16,431 [39 ] Abp.Runtime.Caching.Redis.AbpRedisCache - Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: S. Path '', line 0, position 0.
at Newtonsoft.Json.JsonTextReader.ParseValue()
at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
at Abp.Runtime.Caching.Redis.DefaultRedisCacheSerializer.Deserialize(RedisValue objbyte)
at Abp.Runtime.Caching.Redis.AbpRedisCache.Deserialize(RedisValue objbyte)
at Abp.Runtime.Caching.Redis.AbpRedisCache.GetOrDefault(String key)
at Abp.Runtime.Caching.CacheBase.GetOrDefaultAsync(String key)
at Abp.Runtime.Caching.CacheBase.GetAsync(String key, Func2 factory) Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: S. Path '', line 0, position 0. at Newtonsoft.Json.JsonTextReader.ParseValue() at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent) at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType) at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings) at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings) at Abp.Runtime.Caching.Redis.DefaultRedisCacheSerializer.Deserialize(RedisValue objbyte) at Abp.Runtime.Caching.Redis.AbpRedisCache.Deserialize(RedisValue objbyte) at Abp.Runtime.Caching.Redis.AbpRedisCache.GetOrDefault(String key) at Abp.Runtime.Caching.CacheBase.GetOrDefaultAsync(String key) at Abp.Runtime.Caching.CacheBase.GetAsync(String key, Func
2 factory)
Cache test: DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - *** Testing Caches *** DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Reading Cache: AppImpersonationCache DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Cache Read : AppImpersonationCache DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Reading Cache: AbpZeroUserPermissions DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Cache Read : AbpZeroUserPermissions DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Reading Cache: GetLocalityList1nodeGRA02region19 DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Cache Read : GetLocalityList1nodeGRA02region19 DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Reading Cache: GetLocalityList1nodeGRA04region19 DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Cache Read : GetLocalityList1nodeGRA04region19 DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Reading Cache: OCPNode_GetStreetList DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Cache Read : OCPNode_GetStreetList DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Reading Cache: GetLocalityList1nodeHAY03region19 DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Cache Read : GetLocalityList1nodeHAY03region19 DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Reading Cache: GetLocalityList1nodeHAY02region19 DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Cache Read : GetLocalityList1nodeHAY02region19 DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Reading Cache: AbpUserSettingsCache DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Cache Read : AbpUserSettingsCache DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Reading Cache: AbpTenantSettingsCache DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Cache Read : AbpTenantSettingsCache DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Reading Cache: AbpZeroTenantFeatures DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Cache Read : AbpZeroTenantFeatures DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Reading Cache: AbpZeroMultiTenantLocalizationDictionaryCache DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Cache Read : AbpZeroMultiTenantLocalizationDictionaryCache DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Reading Cache: GetLocalityList1nodeGRA08region19 DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Cache Read : GetLocalityList1nodeGRA08region19 DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Reading Cache: OCPNode_GetNodesForTree1 DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Cache Read : OCPNode_GetNodesForTree1 DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Reading Cache: OCPNode_GetScadaParserSettingsList DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Cache Read : OCPNode_GetScadaParserSettingsList DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Reading Cache: GetUserOptionsforOutageMap_1_user_10080 DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Cache Read : GetUserOptionsforOutageMap_1_user_10080 DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Reading Cache: OCPNode_GetDefaultNodeValues_siteId_1_user_10080 DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Cache Read : OCPNode_GetDefaultNodeValues_siteId_1_user_10080 DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Reading Cache: OCPNode_GetAvenueList DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Cache Read : OCPNode_GetAvenueList DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Reading Cache: AbpZeroLanguages DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Cache Read : AbpZeroLanguages DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Reading Cache: OCPNode_GetMessageLinkList DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Cache Read : OCPNode_GetMessageLinkList DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Reading Cache: OCPNode_GetDefaultNodeValues_siteId_1_user_10016 DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Cache Read : OCPNode_GetDefaultNodeValues_siteId_1_user_10016 DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Reading Cache: GetSiteOptionsForOutageMap_1 DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Cache Read : GetSiteOptionsForOutageMap_1 DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Reading Cache: AbpApplicationSettingsCache DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Cache Read : AbpApplicationSettingsCache DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Reading Cache: OCPNode_GetNodeLocality DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Cache Read : OCPNode_GetNodeLocality DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Reading Cache: GetRegionTypeOutage1regionCode19 DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Cache Read : GetRegionTypeOutage1regionCode19 DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Reading Cache: AbpZeroTenantCache DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Cache Read : AbpZeroTenantCache DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Reading Cache: OCPNode_GetNodeTypes DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Cache Read : OCPNode_GetNodeTypes DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Reading Cache: GetUserOptionsforOutageMap_64_user_10010 DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Cache Read : GetUserOptionsforOutageMap_64_user_10010 DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Reading Cache: GetLocalityList1node1GEN99region19 DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Cache Read : GetLocalityList1node1GEN99region19 DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Reading Cache: OCPNode_GetLocalityList DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Cache Read : OCPNode_GetLocalityList DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Reading Cache: AbpZeroRolePermissions DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Cache Read : AbpZeroRolePermissions DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Reading Cache: OCPNode_GetLanguageMessageList DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Cache Read : OCPNode_GetLanguageMessageList DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Reading Cache: GetSiteOptionsForOutageMap_64 DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Cache Read : GetSiteOptionsForOutageMap_64 DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Reading Cache: OCPNode_GetMessageAttributesPerLanguage DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Cache Read : OCPNode_GetMessageAttributesPerLanguage DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Reading Cache: GetTimeAndCauseLists1 DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Cache Read : GetTimeAndCauseLists1 DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Reading Cache: GetLocalityList1nodeGRA03region19 DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Cache Read : GetLocalityList1nodeGRA03region19 DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Reading Cache: GetUserOptionsforOutageMap_1_user_10016 DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Cache Read : GetUserOptionsforOutageMap_1_user_10016 DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Reading Cache: AppUserFriendCache DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Cache Read : AppUserFriendCache DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Reading Cache: AbpZeroEditionFeatures DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - Cache Read : AbpZeroEditionFeatures DEBUG 2019-04-05 02:00:18,323 [39 ] _Ltd.Avalanche.Caching.CachingAppService - *** Testing Caches Finished ***
What do you mean by "redis database"?
I connect using redis-cli and used commands like "KEYS_ " and "GET" to check all keys added and contents. It seems ok. The main problem is that I don't know exactly with key is getting problem. I have created a routine to loop all keys and call the Get command, just to test which one is raising the exception.
public void TestAllCaches()
{
Logger.Debug("*** Testing Caches ***");
foreach (ICache item in _cacheManager.GetAllCaches())
{
Logger.Debug("Reading Cache: " + item.Name);
var cacheValue = _cacheManager.GetCache(item.Name);
Logger.Debug("Cache Read : " + item.Name);
}
Logger.Debug("*** Testing Caches Finished ***");
}
@maliming
I have already done it:
public async Task ClearAllCaches()
{
var caches = _cacheManager.GetAllCaches();
foreach (var cache in caches)
{
await cache.ClearAsync();
}
}
Hi @maliming.
I did it, but doesn't work. I have already tried to restart the IIS and Redis service. But, after initializing everything it starts to show again.