Closed krombipils closed 5 years ago
The DevExpress.XAF repository includes commits that relate to this task:
Please update the related Nuget packages and test if issues is addressed. These are nightly nuget packages available only from our NugetServer.
If you do not use the Xpand.XAF.Modules directly but through a module of the main eXpandFramework project, please wait for the bot to notify you again when integration is finished or update the related packages manually.
Thanks a lot for your contribution.
The console app server in my sample solution is working fine after I upgraded the ModelMapper module. Unfortunately in my production solution, the app server (hosted in IIS) is still not working. But now a new Stackoverflow exception occurs, when XAF creates the model.
After quite a lot of debugging I realized that this is related to IModelDevExpressXtraTreeList_TreeList TreeList
and IModelDevExpressXtraTreeListColumns_TreeListColumn Column
properties generated by the ModelMapper.
I don't really understand what's going wrong and how to repro it in the simple console app server, but the problem is somehow related to this line of code in ModelCode.cs:
var typeCode = modelCode .ToEnumerable().SelectMany(_ => _).GroupBy(_ => _.code.key).SelectMany(_ => _.OrderByDescending(tuple => tuple.code.map).Take(1))
I added a TraceModelMapper and wrote out the generated code in my (working) Solution5 console app. The resoluting file contains no IModelDevExpressXtraTreeListColumns_TreeListColumn Column
properties, but in my problematic trace, IModelDevExpressXtraTreeListColumns_TreeListColumn Column
properties exists.
Then I changed the Take(1)
to Take(2)
and run the trace again on both projects. Now in both traces IModelDevExpressXtraTreeListColumns_TreeListColumn Column
properties exist.
It is really hard for me to understand your code. Why are different versions of the same interfaces generated, e.g IModelDevExpressXtraTreeListViewInfo_BandInfo
? What does the Take(1)
selects the correct version in one project but not in the other?
As a workaround I filtered the modelcode with Where(_ => !_.code.code.Contains("IModelDevExpressXtraTreeList_TreeList TreeList")).Where(_ => !_.code.code.Contains("IModelDevExpressXtraTreeListColumns_TreeListColumn Column")).
and it is working fine now.
traces.zip
Unfortunately in my production solution, the app server (hosted in IIS) is still not working. But now a new Stackoverflow exception occurs, when XAF creates the model.
what about on your local iis? maybe it loads a previously generated type somehow?
var typeCode = modelCode .ToEnumerable().SelectMany( => ).GroupBy( => .code.key).SelectMany( => .OrderByDescending(tuple => tuple.code.map).Take(1))
I ll try to help u understand this part with some comments
var typeCode = modelCode //at this point we have an IObservable<T> as it is the result of a Task<T> we used to send the code generation work to the pool
.ToEnumerable() //however this is a cold Observable (it terminates as it has finite items - Replay operator just b4) and we can convert it to IEnumerable<T>
.SelectMany(_ => _).GroupBy(_ => _.code.key).SelectMany(_ => _.OrderByDescending(tuple => tuple.code.map).Take(1)) //the code generation it is not optimized and may contain doubles as the end user may register modules that generate the same maps, so here we only Take(1) i
.Select(_ => (_.code.code, _.references)).ToObservable(); //and we project it to another that matches our previus work so the Concat is possible as you can only concat same types
It is really hard for me to understand your code. Why are different versions of the same interfaces
I cannot follow this? does it refer to my previous comment on duplicates?
It is really hard for me to understand your code. Why are different versions of the same interfaces generated, e.g IModelDevExpressXtraTreeListViewInfo_BandInfo? What does the Take(1) selects the correct version in one project but not in the other?
These results are scheduled to the Thread pool their order is not guaranteed
not that as explain in docs https://github.com/eXpandFramework/DevExpress.XAF/tree/master/src/Modules/ModelMapper#how-to-customize-a-map u could filter down the generation using a strong type approach rather string which may change without notice.
I appreciate your deep debug efforts and the time u spend and want to help further however the traces are huge to understand something. Perhaps a sample?
but first I would test the local iis so to make sure that is not some caching issue
TypeMappingService.PropertyMappingRules.Add(("RemoveTreeListMap", _ => {
if (_.declaringType == PredefinedMap.TreeList.TypeToMap()){
_.propertyInfos.Clear();
}
}));
somthing like this will probaly have the same effect as you filter, however feel free to post related info if u decide to go another debugging round. Happy to extend the module further to make our life easier.
does it refer to my previous comment on duplicates?
Have a look at the take2 trace, e.g for IModelDevExpressXtraTreeListViewInfo_TreeListViewInfo
there are two entries (code) in the trace. From your explanations I would expect both code snippets to be identical. But only the first one is correct, as it does not contain the IModelDevExpressXtraTreeList_TreeList TreeList
info.
These results are scheduled to the Thread pool their order is not guaranteed
I guess this explains, why it only happens in the web server. In the console version the right/first version is always selected by Take(1). There is also a 'wrong' version of the interface in the console app, but it is not used. In the web version the ordering of the generated interfaces differ.
But why does the generated code for IModelDevExpressXtraTreeList_TreeList TreeList
differ at all? Is it somehow related to assembly loading? What is the best way to debug the code generation for IModelDevExpressXtraTreeList_TreeList TreeList
?
I added a TraceModelMapper and wrote out the generated code in my (working) Solution5 console app. The resoluting file contains no IModelDevExpressXtraTreeListColumns_TreeListColumn Column properties, but in my problematic trace, IModelDevExpressXtraTreeListColumns_TreeListColumn Column properties exists.
does this means u recompile?
I will answer the rest of your questions in a bit as I am researching as well
also I want to know if u use Xpand Chart or Pivot or Dashboard modules as the TreeListViewInfo is a base class to their maps
does this means u recompile?
Jap, I recompiled ModelMapper module for debugging purposes.
I attached an updated sample project. There is no problem in this project (because it does not use IIS, but the console server), but if you check the trace with Take(2) instead of Take(1) you will see the difference in the generated code. This solution uses the XpandTreeListWin module directly (without it, everything is fine).
Should I also upload my modified tracing ModelMapper dll? Solution5_1.zip
yes i see the difference I am also adding additional trace calls to the ModelMapper to trace generated code per type and per assembly (total) and the with the ReactiveLoggerClient u can visualise a structured event info
So to my understading the sample does not provide further info
So to my understading the sample does not provide further info
If you already see the difference, my sample does not provide further info. Do you have have enough info to go on, or could I help?
ReactiveLoggerClient looks very interesting. I should have known about it before... Debugging the observable/reactive code (never worked with it before) was quite a pain in the ass.
thats why i develop the tool can also log over remote directly from your iis. However I do not have a clear picture which maps are generated u can use the reactive logger and filter on the MapToModel method if u do not know exactly
latest commit on lab contains detailed tracing and the TypeMappingService.ModelCodeScheduler which u can set to Scheduler.Immediate to make code generation synchronous
however tests fail with my latest changes so I suggest u wait for a build
The DevExpress.XAF repository includes commits that relate to this task:
Please update the related Nuget packages and test if issues is addressed. These are nightly nuget packages available only from our NugetServer.
If you do not use the Xpand.XAF.Modules directly but through a module of the main eXpandFramework project, please wait for the bot to notify you again when integration is finished or update the related packages manually.
Thanks a lot for your contribution.
there are still issues with modelmapper tests System.OutOfMemoryException is raised only on Azure it may related
I'm currently trying to trace/debug your updated ModelMapper module with the ReactiveLoggerClient, but I'm a little bit lost. According to the documentation I should add the Xpand.XAF.Modules.Reactive.Logger.Client.Win
package to my server application project and add the Xpand.XAF.Modules.Reactive.Logger.Client.Win.Reactive.Logger.Client.WinModule
. Is this correct? But there is no Client.WinModule module in this package.
I added the ReactiveLoggerHubModule
instead, but I still cannot see any trace events in the logger application.
the Client is an exe at the moment is on Nuget but will be on Chocolatey as this makes more sense. So u get the client from nuget for now put it a in a dir. Then install the Reactive.Logger.Hub package which is a module to your app and this package transmits the logs which are received from the client.
u do not need the hub package if u only want to log locally however the client is handy as it works for all your apps that the Hub is install without configuration. I just have it open and consult it when I want for all the tests in the DevExpress.XAF repo
so to elab on it
each package on DevExpress.XAf repo is a seperate asembly and has a seperate Test project. Each Test starts a TestXafApplition. So this app has the Hub installed and it can transmit to the client.exe which I have it always up and running.
let me know if u find problems please
the same view that I posted before from the client.exe can be shown in your local app without the Hub installed. It uses the TraceEvent BO to persist in the db if logging is enabled from the Model options
there are still issues with modelmapper tests System.OutOfMemoryException is raised only on Azure it may related
it may also be unrelated as after disabling codecoverage there are no exceptions
if logging is enabled from the Model options
Where can I find this logging option in the model? And how do I use it from a console app server?
And If I got you right, as an alternative approach I could add the ReactiveLoggerHubModule to my app server project and then there is no need for additional configuration?
I am updaing the docs to make it more clear now. The config for the client is located at ReactiveModules/ReactiveLogger/LoggerPorts. The client monitors a range while the actuall XAF application transimits only in one port. Each RX package transimts in different ports thats why the client moniotrs a range. All are preconfigured so u do not need to change anything unlless u want.
also your TraseSources under the same Model Node for your XAF app should be on verbose, client is already verbose
If you check my Solution5.Module and Solution5.Module.Win models, there is no ReactiveLogger under the ReactiveModules list (because I did not installed it explicitly). Should I add it to the Solution5.Module? I added the LoggerHubModule to my Solution5.ApplicationServer project and In the debugger I see that StartServer is called, but I guess it does not run, because in the Solution5.ApplicationServer there is no Model.DesignedDiffs.xafml and therefore the server port cannot be configured?!
hmm yes your case is a bit different since your actually have 2 XAF apps one is your solution5 the other is your applicationserver. If u install the hub to both of this apps (logger does not need explicit install its a dependency on hub) the the RXLogger.Client.Exe will display messages from both
apologies now I got what u mean the client displays nothing for your solution5, I ll let u know in a bit
i see what happens here, the logger in addition to transmition it stores the messages to local db which is only valid after logon but your appserver does never logon. Explicit call to server.Logon will trigger transmission
though buffer all messages and transmit after logon is not a solution at least for this case because we have a stackoverflow on setup. I am afraid the Hub needs further encasement and cannot help u
note that ReactiveTraceLister logs everything to a file which is done on real time
but you lose the visual help offered from the client
installed the latest hub package from nuget.org 0.0.8 only and add this line only to your solution5.module ctor
RequiredModuleTypes.Add(typeof(ReactiveLoggerHubModule));
and my open client displayed this
plus serverApplication.Logon(); after your serverApplication.Setup();
I'm now getting a TypeLoadException when Application.Logon() is called
Solution5.ApplicationServer.exe Error: 0 : 08.10.19 13:07:02.624 no context ================================================================================
The error occurred:
Type: TypeLoadException
Message: Der Typ "DevExpress.Utils.Extensions.UtilsExtensions" in der Assembly "DevExpress.Utils.v19.1, Version=19.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" konnte nicht geladen werden.
Data: 0 entries
Stack trace:
bei Xpand.XAF.Modules.Reactive.Logger.ModelReactiveModuleLogger.ReactiveLogger(IModelReactiveModules reactiveModules)
bei Xpand.XAF.Modules.Reactive.Logger.ModelReactiveModuleLogger.<>c.<ReactiveLogger>b__0_0(IModelReactiveModules modules)
bei System.Reactive.Linq.ObservableImpl.Select`2.Selector._.OnNext(TSource value) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Linq\Observable\Select.cs:Zeile 39.
Do you have any idea what's going on? I cannot find 'UtilsExtensions' in your DevExpress.XAF repo. Where does this come from?
clear your bin perhaps looks like the mapper loads outdated Mapper.dll? I tried with the official version maybe u have some kind of mix in your system. This is a DevExpress.Utils.v19.1 assembly and type
maybe add it explicitly to test if it will pass?
I have a reference to Xpand.XAF.Modules.Reactive.Logger.Hub version 0.0.8.1. I cleaned up bin/obj and added a reference to Xpand.XAF.Modules.ModelMapper version 1.1.48.1. In the debug modules window I can see that DevExpress.Utils.dll 19.1.6 is loaded.
But the TypeLoadException persist. Actually I cannot find DevExpress.Utils.Extensions.UtilsExtensions in DevExpress.Utils.dll
these are lab versions not official can u try with the official as I did?
and I used Nugets not references
I meant nuget package references and I used 1.1.48.1 because of your improved tracing code. I will now try the official releases
i am not sure how well they work
https://github.com/eXpandFramework/eXpand/issues/542#issuecomment-539394083
it maybe Azure to blame but it maybe not
i am going to try to minimize memory consumption in the next build to see if there is an improvement but first have to measure it
i can repro the problem with the lab versions also but it maybe cause Xpand.ExpressApp.Win uses official ModelMapper?? shouldn't have an issue though
it maybe Azure to blame
I also noticed this OutOfMemoryException once on my local computer, therefore I think it is not directly related to Azure
I cannot use the MiddleTier application server anymore. An exception is thrown on
application.Setup()
. This happens because theXpand.ExpressApp.Win.SystemModule.Setup()
callsmoduleManager.Extend(PredefinedMap.AdvBandedGridView, ...)
but thePredefinedMapService.GetModelMapperConfiguration
cannot find this map.The map cannot be found, because the
ModelExtendingService.Platform
is detected asPlatform.Web
: InXafApplicationExtensions.GetPlatform()
application.GetPlatform()
is called and this returnsPlatform.Web
for theMiddleTier.ServerApplication
return baseType?.Name=="WinApplication"?Platform.Win : Platform.Web;
I attached a simple demo project. The exception is thrown when running the console server application Solution5.zip