eXpandFramework / eXpand

DevExpress XAF (eXpressApp) extension framework. 𝗹𝗶𝗻𝗸𝗲𝗱𝗶𝗻.𝗲𝘅𝗽𝗮𝗻𝗱𝗳𝗿𝗮𝗺𝗲𝘄𝗼𝗿𝗸.𝗰𝗼𝗺, 𝘆𝗼𝘂𝘁𝘂𝗯𝗲.𝗲𝘅𝗽𝗮𝗻𝗱𝗳𝗿𝗮𝗺𝗲𝘄𝗼𝗿𝗸.𝗰𝗼𝗺 and 𝘁𝘄𝗶𝘁𝘁𝗲𝗿 @𝗲𝘅𝗽𝗮𝗻𝗱𝗳𝗿𝗮𝗺𝗲𝘄𝗼𝗿𝗸 and or simply 𝗦𝘁𝗮𝗿/𝘄𝗮𝘁𝗰𝗵 this repository and get notified from 𝗚𝗶𝘁𝗛𝘂𝗯
http://expand.expandframework.com
Microsoft Public License
220 stars 114 forks source link

Visual Studio Model Editor not working due to ModelMapper module #488

Closed krombipils closed 5 years ago

krombipils commented 5 years ago

Currently the ModelMapper does not support the Visual Studio Model Editor. However you can use the XpandModelEditor found in the Xpand.VSIX package. Note that the XpandModelEditor is embedded and version agnostic so its one time only installation.

It took me quite a while to realize that the Visual Studio Model Editor is not working anymore due to issues in the ModelMapper module. Do you have any plans to fix these issues? At least a better error message should be shown.

I also noticed, that the 'Merge User Model...' command is not working anymore since I upgraded from 19.1.3 to 19.1.5. Is this caused by the same issue? Is there any alternative in the XpandModelEditor?

apobekiaris commented 5 years ago

At least a better error message should be shown.

do u have any suggestions? why this message is not clear?

I also noticed, that the 'Merge User Model...'

probably an additional action could resolve this case, I will update u again.

Do you have any plans to fix these issues?

VS insanity is really costly I thought it might be possible to avoid it, I might reconsider this desicion.

krombipils commented 5 years ago

do u have any suggestions? why this message is not clear?

Sometimes the VS Model Editor complains about being unable to load "System.Interactive, Version=3.2.0.0" at Xpand.XAF.Modules.ModelMapper.Services.ModelExtendingService.AddExtenders(ModelInterfaceExtenders extenders) and sometimes the PredefinedMapService tells me to add ModelMapperModule to the RequiredModuleTypes, although it is already added (I guess this happens, because the static Init() method is not executed, when running VS Model Editor).

It was not clear for me, that nothing is wrong with my setup and it is just not possible to use the VS Model Editor anymore. I'm not sure whether it is possible to check if the VS Model Editor is running and throw an InvalidOperationException("Use XpandModelEditor!!!") in this case?!


probably an additional action could resolve this case, I will update u again.

Great!


VS insanity is really costly I thought it might be possible to avoid it, I might reconsider this desicion.

If you find an alternative for Merge User Model and also display a nice error message when trying to use the default VS ModelEditor, using the XpandModelEditor is absolutely fine for me!

apobekiaris commented 5 years ago

both the action and the message is possible, I still not sure where to spent resources though.

because the static Init() method is not executed, when running VS Model Editor)

I am interested in this comment, can u elab a bit more. What makes u say that a static contructor is not called?

krombipils commented 5 years ago

I still not sure where to spent resources though.

Right now in my development setup, a SuperUser customizes ListViews/DetailViews and sends me the Model.User.xafml to merge in the changes into our different modules xafmls. Of course it is also possible to merge changes with a texteditor, but this is really an annoying job. Therefore I really would like to use the 'Merge User Model...' action again.


What makes u say that a static contructor is not called?

I guess you are right: The static constructor should be called always. Probably I attached the Debugger to late. Nevertheless the various static Assembly fields (_xafWinAssembly, ...) are null and therefore the error is thrown.

apobekiaris commented 5 years ago

Right now in my development setup, a SuperUser customizes ListViews/DetailViews and sends me the Model.User.xafml to merge in the changes into our different modules xafmls. Of course it is also possible to merge changes with a texteditor, but this is really an annoying job. Therefore I really would like to use the 'Merge User Model...' action again.

You can try the ModelDifference module for now until I update u it can merge differences at runtime in seperate layers and then u can manually copy them to your model.user.xafml

apobekiaris commented 5 years ago

I guess you are right: The static constructor should be called always. Probably I attached the Debugger to late. Nevertheless the various static Assembly fields (_xafWinAssembly, ...) are null and therefore the error is thrown.

actually the real problem is that VS maybe not able to handle so many resources introduced from the mapping, anyway I am starting a trial on the MMM and I will update u asap

apobekiaris commented 5 years ago

if i remember well u r not in GAC right?

krombipils commented 5 years ago

You can try the ModelDifference module for now until I update u it can merge differences at runtime in seperate layers and then u can manually copy them to your model.user.xafml

Sounds like a sensible workaround

if i remember well u r not in GAC right?

Latest DevExpress version is installed in the GAC on my development machine, eXpand is not installed. On our build server DevExpress is not installed in the GAC, but this shouldn't matter.

apobekiaris commented 5 years ago

we might need to set an eviroment variable to help vs locate the assemblies if not in gac and not in path

krombipils commented 5 years ago

But this is not the problem on my side. The DX assemblies are in the GAC. Or are you talking about Xpand assemblies?

apobekiaris commented 5 years ago

sorry I am used to adding thoughts/notes on the ticket itself not to lose them

expand commented 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.

krombipils commented 5 years ago

Thank you!

Unfortunately there still seems to be a bug: If I open Model.xafml from my agnostic module, everything is fine. But if I try to open Model.xafml from my winforms module, the Multiple ModelMapper assemblies in the domain check your Model.DesignedDiffs.log if you are at design time error is thrown. According to the log, ModelMapper is loaded from the source folder and also from a AppData\Local\Microsoft\VisualStudio folder

...
Xpand.XAF.Modules.CloneMemberValue, Version=1.2.42.0, Culture=neutral, PublicKeyToken=c52ffed5d5ff0958, Location=C:\Users\andre\AppData\Local\Microsoft\VisualStudio\16.0_f1cafe15\ProjectAssemblies\wbx2kfnx01\Xpand.XAF.Modules.CloneMemberValue.dll
Xpand.XAF.Modules.CloneModelView, Version=0.0.26.0, Culture=neutral, PublicKeyToken=c52ffed5d5ff0958, Location=C:\Users\andre\AppData\Local\Microsoft\VisualStudio\16.0_f1cafe15\ProjectAssemblies\tu1dljya01\Xpand.XAF.Modules.CloneModelView.dll
Xpand.XAF.Modules.HideToolBar, Version=0.0.18.0, Culture=neutral, PublicKeyToken=c52ffed5d5ff0958, Location=C:\Users\andre\AppData\Local\Microsoft\VisualStudio\16.0_f1cafe15\ProjectAssemblies\sbeqhewk01\Xpand.XAF.Modules.HideToolBar.dll
Xpand.XAF.Modules.ModelMapper, Version=1.1.34.2, Culture=neutral, PublicKeyToken=c52ffed5d5ff0958, Location=C:\Users\andre\AppData\Local\Microsoft\VisualStudio\16.0_f1cafe15\ProjectAssemblies\kzbv0qnz01\Xpand.XAF.Modules.ModelMapper.dll
Xpand.XAF.Modules.ModelMapper, Version=1.1.34.2, Culture=neutral, PublicKeyToken=c52ffed5d5ff0958, Location=C:\Users\andre\source\repos\ProjectCompliance\WinForms.Module.Win\bin\Debug\Xpand.XAF.Modules.ModelMapper.dll
Xpand.XAF.Modules.ModelViewInheritance, Version=1.1.34.0, Culture=neutral, PublicKeyToken=c52ffed5d5ff0958, Location=C:\Users\andre\AppData\Local\Microsoft\VisualStudio\16.0_f1cafe15\ProjectAssemblies\lb86-edb01\Xpand.XAF.Modules.ModelViewInheritance.dll
Xpand.XAF.Modules.ProgressBarViewItem, Version=0.0.12.0, Culture=neutral, PublicKeyToken=c52ffed5d5ff0958, Location=C:\Users\andre\AppData\Local\Microsoft\VisualStudio\16.0_f1cafe15\ProjectAssemblies\skdpdmwj01\Xpand.XAF.Modules.ProgressBarViewItem.dll
Xpand.XAF.Modules.Reactive, Version=1.2.42.0, Culture=neutral, PublicKeyToken=c52ffed5d5ff0958, Location=C:\Users\andre\AppData\Local\Microsoft\VisualStudio\16.0_f1cafe15\ProjectAssemblies\p4tyb1bo01\Xpand.XAF.Modules.Reactive.dll
Xpand.XAF.Modules.Reactive, Version=1.2.42.0, Culture=neutral, PublicKeyToken=c52ffed5d5ff0958, Location=C:\Users\andre\source\repos\ProjectCompliance\WinForms.Module.Win\bin\Debug\Xpand.XAF.Modules.Reactive.dll
...
apobekiaris commented 5 years ago

i tested against XVideoRental however there are changes in the eXpand modules yet to be published. u will get notified again

expand commented 5 years ago

eXpand.lab release 19.1.502.2 includes commit that relate to this task:

Please test if it addresses the problem. If you use nuget add our LAB NugetServer as a nuget package source in VS.

Thanks a lot for your contribution.

apobekiaris commented 5 years ago

the above release at least in my tests in XVIdeoRental works fine

krombipils commented 5 years ago

Latest version is still not working on my side, but I guess I found the issue: I have JetBrains ReSharper installed on my machine and it has some dependencies on very old DevExpress libs. The Init() method seems to pick up one of these old assemblies and tries to extract the versionSuffix, but the regex does not match for e.g. DevExpress.Data.v7.1.dll ModelEditor

expand commented 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.

krombipils commented 5 years ago

I'm still getting the Multiple ModelMapper assemblies in the domain error after I upgraded to 1.1.35.1. I deleted the ~\AppData...\ProjectAssemblies folder, but VS recreates it as soon as I try to open the Model.xafml. I don't know why this does not happen on your side, but are multiple ModelMapper assemblies really a problem? Both assemblies have the same version, therefore this should be fine?!

krombipils commented 5 years ago

According to stack overflow, VS designers copy dlls to the ProjectAssemblies folder by default. Therefore it should be save to ignore duplicates in this folder

apobekiaris commented 5 years ago

I don't know why this does not happen on your side, but are multiple ModelMapper assemblies really a problem?

yes there is a different initialization for the double thats why I added that constrain.

I don't know why this does not happen on your side

unfortunately i cannot repro it on my side what the locations of ModelMapper? check the log

apobekiaris commented 5 years ago

yes there is a different initialization for the double

2 types are different if they come for different assembly even if versions, token match

krombipils commented 5 years ago

unfortunately i cannot repro it on my side what the locations of ModelMapper? check the log

I already posted the log for the old version. Locations are the same for the new version

Xpand.XAF.Modules.ModelMapper, Version=1.1.34.2, Culture=neutral, PublicKeyToken=c52ffed5d5ff0958, Location=C:\Users\andre\AppData\Local\Microsoft\VisualStudio\16.0_f1cafe15\ProjectAssemblies\kzbv0qnz01\Xpand.XAF.Modules.ModelMapper.dll
Xpand.XAF.Modules.ModelMapper, Version=1.1.34.2, Culture=neutral, PublicKeyToken=c52ffed5d5ff0958, Location=C:\Users\andre\source\repos\ProjectCompliance\WinForms.Module.Win\bin\Debug\Xpand.XAF.Modules.ModelMapper.dll

The winforms designer cache is a standard feature of VS, but I think it is not documented very well (and it is the cause of some annoying bugs...) I now installed ModelMapper.dll to the GAC and this fixes this problem (only the dll from the GAC is loaded). Of course this is not a real solution, but maybe you cannot repro my problem, because you are also using the GAC?

Unfortunately I still cannot use the ModelEditor, because I'm now back to the unable to load "System.Interactive, Version=3.2.0.0" at Xpand.XAF.Modules.ModelMapper.Services.ModelExtendingService.AddExtenders(ModelInterfaceExtenders extenders) issue. System.Interactive is actually not loaded in Visual Studio.

apobekiaris commented 5 years ago

did u close this by mistake?

No I do not use the GAC,

494 not yet published contain related fixes, subscribe there to get notifiex, also please update your modelmapper to the latest or wait for update the eXpandFramework all together I will integrate it soon.

krombipils commented 5 years ago

did u close this by mistake? Jap, re-opened it.

No I do not use the GAC, Okay, then I have no idea where's the difference. Looking forward to your latest changes

expand commented 5 years ago

eXpand.lab release 19.1.502.7 includes commit that relate to this task:

Please test if it addresses the problem. If you use nuget add our LAB NugetServer as a nuget package source in VS.

Thanks a lot for your contribution.

expand commented 5 years ago

eXpand.lab release 19.1.502.8 includes commit that relate to this task:

Please test if it addresses the problem. If you use nuget add our LAB NugetServer as a nuget package source in VS.

Thanks a lot for your contribution.

krombipils commented 5 years ago

Thank you!!! I don't know how you did it, but the VS ModelEditor is finally working again!

btw: According to the debugger, only the ModelMapper.dll from the ProjectAssemblies path is loaded...