eXpandFramework / eXpand

DevExpress XAF (eXpressApp) extension framework. š—¹š—¶š—»š—øš—²š—±š—¶š—».š—²š˜…š—½š—®š—»š—±š—³š—暝—®š—ŗš—²š˜„š—¼š—暝—ø.š—°š—¼š—ŗ, š˜†š—¼š˜‚š˜š˜‚š—Æš—².š—²š˜…š—½š—®š—»š—±š—³š—暝—®š—ŗš—²š˜„š—¼š—暝—ø.š—°š—¼š—ŗ and š˜š˜„š—¶š˜š˜š—²š—æ @š—²š˜…š—½š—®š—»š—±š—³š—暝—®š—ŗš—²š˜„š—¼š—暝—ø and or simply š—¦š˜š—®š—æ/š˜„š—®š˜š—°š—µ this repository and get notified from š—šš—¶š˜š—›š˜‚š—Æ
http://expand.expandframework.com
Microsoft Public License
222 stars 115 forks source link

Error on Harmony Patch 4.202.52 #866

Closed nitrixHub closed 11 months ago

nitrixHub commented 3 years ago

ERROR:

Null method for XAF

š—¤š˜‚š—²š˜€š˜š—¶š—¼š—»

We are trying to migrate to a full Nuget Packages eXpand libraries solution, it has been difficult to follow up among the compatibility with DexExpress and 3rd parties libraries dependencies, the converter is called in every build and application is just not working, not even starting.

We even remove XAF the Mobile Modules from our solution and copiled every module getting hundreds of issues, we are following the approach to add the new CORE and WEB packages directly to solve the incompatibility issues raised by the libraries.

The first question will be for the 3rd parties dependencies of the libraries, we had a local copy of the 0harmony.dll and fastreflec library currently with the Nuget solution we are not sure which one to select form the Nuget Server Source or whether we should keep using our old versions:

Which version of Harmony Lib is compatible with Xpand.XAF.Modules.Reactive 4.202.52, DevExpress 20.2.6.0

Currently used in our compile set is :

0Harmony, Version=2.0.4.0, Culture=neutral, PublicKeyToken=c52ffed5d5ff0958

On Nuget

The error occurred:

Type:       InvalidOperationException
Message:    Exception occurs while initializing the 'Xpand.XAF.Modules.ModelViewInheritance.ModelViewInheritanceModule' module: The type initializer for 'Xpand.XAF.Modules.ModelViewInheritance.ModelViewInheritanceService' threw an exception.
Data:       1 entries
        'ASPIMPERSONATING'      ''
Stack trace:

at Xpand.XAF.Modules.Reactive.ReactiveModuleBase.SetupModules(ApplicationModulesManager applicationModulesManager) in D:\a\1\s\src\Modules\Reactive\ReactiveModuleBase.cs:line 87 at Xpand.XAF.Modules.Reactive.ReactiveModuleBase.SetupModulesPatch(ApplicationModulesManager __instance) in D:\a\1\s\src\Modules\Reactive\ReactiveModuleBase.cs:line 53 at DevExpress.ExpressApp.ApplicationModulesManager.SetupModules_Patch1(ApplicationModulesManager this) at DevExpress.ExpressApp.ApplicationModulesManager.Load(ITypesInfo typesInfo, Boolean loadTypesInfo) at DevExpress.ExpressApp.XafApplication.SetupCore(String applicationName, IList`1 objectSpaceProviders, ApplicationModulesManager modulesManager, ISecurityStrategyBase security) at DevExpress.ExpressApp.XafApplication.Setup() at databank.Web.Global.Session_Start(Object sender, EventArgs e) in C:\dev\databank\databank.Web\Global.asax.cs:line 63 at System.Web.SessionState.SessionStateModule.RaiseOnStart(EventArgs e) at System.Web.SessionState.SessionStateModule.CompleteAcquireState() at System.Web.SessionState.SessionStateModule.BeginAcquireState(Object source, EventArgs e, AsyncCallback cb, Object extraData) at System.Web.HttpApplication.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

InnerException:

        Type:       TypeInitializationException
        Message:    The type initializer for 'Xpand.XAF.Modules.ModelViewInheritance.ModelViewInheritanceService' threw an exception.
        Data:       0 entries
        Stack trace:

at Xpand.XAF.Modules.ModelViewInheritance.ModelViewInheritanceService.Connect(ApplicationModulesManager manager) at Xpand.XAF.Modules.ModelViewInheritance.ModelViewInheritanceModule.Setup(ApplicationModulesManager moduleManager) in D:\a\1\s\src\Modules\ModelViewInheritance\Module.cs:line 17 at Xpand.XAF.Modules.Reactive.ReactiveModuleBase.SetupModules(ApplicationModulesManager applicationModulesManager) in D:\a\1\s\src\Modules\Reactive\ReactiveModuleBase.cs:line 80

        InnerException:

                Type:       NullReferenceException
                Message:    Null method for XAF
                Data:       0 entries
                Stack trace:

Thanks for your understanding and Support

nitrixHub commented 3 years ago

System Environment OS Version: Microsoft Windows NT 10.0.19041.0 .Net Framework Versions: v4.0.30319 CLR Version: 4.0.30319.42000 eXpressApp Version: 20.2.6.0 eXpressApp File Version: 20.2.6.0

apobekiaris commented 3 years ago

I suggest to use the container packages instead as they are consumed and EasyTested. See https://www.youtube.com/watch?v=LvxQ-U_0Sbg&t=1s

there should be no problems using the container packages for both DX and Xpand, nor extra dependecies as demoed in the video.

nitrixHub commented 3 years ago

Did the reference change to packages, the source is Nuget.org (using the lab source nuget library will change every week ), need stability The used Nuget Source is normal nuget.org Added the modules XAF.ALL and XAF.CORE Still getting this Line (when trying to register the Dashboard or Email components) - They are installed in the solution, project and everywhere BTW. Error when the designer is trying to open: Could not load file or assembly '0Harmony, Version=2.0.4.0, Culture=neutral, PublicKeyToken=c52ffed5d5ff0958' or one of its dependencies. The system cannot find the file specified.

If I remove the references.. well no error opening the designer (in both cases compiles without issues).

Best Regards.

apobekiaris commented 3 years ago

using the lab source nuget library will change every week

the RX packages use the VersionConverter which mean u can keep the same version as long as u like if u wish even if u update XAF

Error when the designer is trying to open:

try the XpandModelEditor from the VSIX package

https://github.com/eXpandFramework/Reactive.XAF/tree/master/tools/Xpand.XAF.ModelEditor#vsix-integration

nitrixHub commented 3 years ago

Thanks for the follow up.

I manage to update the libs (nuget based), is compiling and working, but the design level visual components (Model Editor, VSIX Model Editor, VS 2019 Designer ) are failing when there is a dependency with the harmony 2.0 library

Failing Modules in design mode:

One of the examples: VS 2019 App Designer: System.TypeInitializationException: The type initializer for 'Xpand.Persistent.Base.General.XpandModuleBase' threw an exception. ---> System.TypeInitializationException: The type initializer for 'Xpand.Extensions.XAF.AppDomainExtensions.AppDomainExtensions' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly '0Harmony, Version=2.0.4.0, Culture=neutral, PublicKeyToken=c52ffed5d5ff0958' or one of its dependencies. The system cannot find the file specified. at Xpand.Extensions.XAF.AppDomainExtensions.AppDomainExtensions..cctor() --- End of inner exception stack trace --- at Xpand.Extensions.XAF.AppDomainExtensions.AppDomainExtensions.AddModelReference(AppDomain appDomain, String[] name) at Xpand.Persistent.Base.General.XpandModuleBase..cctor() in D:\a\1\s\Xpand\Xpand.Persistent\Xpand.Persistent.Base\General\XpandModuleBase.cs:line 94 --- End of inner exception stack trace --- at System.Runtime.Remoting.RemotingServices.AllocateUninitializedObject(RuntimeType objectType) at System.Runtime.Remoting.Activation.ActivationServices.CreateInstance(RuntimeType serverType) at System.Runtime.Remoting.Activation.ActivationServices.IsCurrentContextOK(RuntimeType serverType, Object[] props, Boolean bNewObj) at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.SecurityUtils.SecureConstructorInvoke(Type type, Type[] argTypes, Object[] args, Boolean allowNonPublic, BindingFlags extraFlags) at System.ComponentModel.ReflectTypeDescriptionProvider.CreateInstance(IServiceProvider provider, Type objectType, Type[] argTypes, Object[] args) at System.ComponentModel.TypeDescriptor.TypeDescriptionNode.CreateInstance(IServiceProvider provider, Type objectType, Type[] argTypes, Object[] args) at Microsoft.VisualStudio.Design.MultiTargetingProvider.CreateInstance(IServiceProvider provider, Type objectType, Type[] argTypes, Object[] args) at System.ComponentModel.TypeDescriptor.TypeDescriptionNode.CreateInstance(IServiceProvider provider, Type objectType, Type[] argTypes, Object[] args) at System.ComponentModel.TypeDescriptionProvider.CreateInstance(IServiceProvider provider, Type objectType, Type[] argTypes, Object[] args) at System.ComponentModel.TypeDescriptor.TypeDescriptionNode.CreateInstance(IServiceProvider provider, Type objectType, Type[] argTypes, Object[] args) at System.ComponentModel.DelegatingTypeDescriptionProvider.CreateInstance(IServiceProvider provider, Type objectType, Type[] argTypes, Object[] args) at System.ComponentModel.TypeDescriptor.TypeDescriptionNode.CreateInstance(IServiceProvider provider, Type objectType, Type[] argTypes, Object[] args) at System.ComponentModel.TypeDescriptor.CreateInstance(IServiceProvider provider, Type objectType, Type[] argTypes, Object[] args) at System.ComponentModel.Design.DesignSurface.CreateInstance(Type type) at Microsoft.VisualStudio.Design.VSDesignSurface.CreateInstance(Type type) at System.ComponentModel.Design.DesignerHost.System.ComponentModel.Design.IDesignerHost.CreateComponent(Type componentType, String name) at System.ComponentModel.Design.Serialization.DesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer) at System.ComponentModel.Design.Serialization.DesignerSerializationManager.System.ComponentModel.Design.Serialization.IDesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer) at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeInstance(IDesignerSerializationManager manager, Type type, Object[] parameters, String name, Boolean addToContainer) at System.ComponentModel.Design.Serialization.ComponentCodeDomSerializer.DeserializeInstance(IDesignerSerializationManager manager, Type type, Object[] parameters, String name, Boolean addToContainer) at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager manager, String name, CodeExpression expression) at System.ComponentModel.Design.Serialization.CodeDomSerializer.DeserializeStatementToInstance(IDesignerSerializationManager manager, CodeStatement statement) at System.ComponentModel.Design.Serialization.CodeDomSerializer.Deserialize(IDesignerSerializationManager manager, Object codeObject) at DevExpress.ExpressApp.Design.XafModuleSerializer.Deserialize(IDesignerSerializationManager manager, Object codeObject) at System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.DeserializeName(IDesignerSerializationManager manager, String name, CodeStatementCollection statements)

DevExpress XAF Module Designer: at DevExpress.ExpressApp.Utils.Reflection.TypeData.CreateInstance(Object[] args) at DevExpress.Persistent.Base.ReflectionHelper.CreateObject(Type objectType, Object[] args) at DevExpress.ExpressApp.Design.ModelEditor.ModelLoader.LoadModel(ITypeDiscoveryService typeDiscoveryService, ITypeResolutionService typeResolutionService, String targetDiffFileName, IDisposable& obj) at DevExpress.ExpressApp.Design.ModelEditor.EditorPane.CreateModelEditorController() at DevExpress.ExpressApp.Design.ModelEditor.EditorPane.PrivateInit(String fileName, ProjectItem currentProjectItem, IVsHierarchy pvHier) ----------InnerException---------- The type initializer for 'Xpand.Persistent.Base.General.XpandModuleBase' threw an exception. ----------StackTrace---------- at Xpand.Persistent.Base.General.XpandModuleBase..ctor() at Xpand.ExpressApp.MapView.Web.MapViewWebModule..ctor() at databank.Web.databankAspNetApplication.InitializeComponent() in C:\dev\databank\databank.Web\WebApplication.cs:line 188 at databank.Web.databankAspNetApplication..ctor() in C:\dev\databank\databank.Web\WebApplication.cs:line 87 at Create_databankAspNetApplication() at DevExpress.ExpressApp.Utils.Reflection.TypeData.CreateInstance(Object[] args) ----------InnerException---------- The type initializer for 'Xpand.Extensions.XAF.AppDomainExtensions.AppDomainExtensions' threw an exception. ----------StackTrace---------- at Xpand.Extensions.XAF.AppDomainExtensions.AppDomainExtensions.AddModelReference(AppDomain appDomain, String[] name) at Xpand.Persistent.Base.General.XpandModuleBase..cctor() ----------InnerException---------- Could not load file or assembly '0Harmony, Version=2.0.4.0, Culture=neutral, PublicKeyToken=c52ffed5d5ff0958' or one of its dependencies. The system cannot find the file specified. ----------StackTrace---------- at Xpand.Extensions.XAF.AppDomainExtensions.AppDomainExtensions..cctor()

apobekiaris commented 3 years ago

VS designers are black box and I avoid them as they only aim to a friendly introduction to new users and come with many problems. I cannot help u unless i can repro the case, note that there is sponsoring available in case u want to buy some hrs to work on it. It would be cheaper I guess than u spenting

System.IO.FileNotFoundException: Could not load file or assembly '0Harmony, Version=2.0.4.0, Culture=neutral, PublicKeyToken=c52ffed5d5ff0958'

focus on this and analyze its word

It is a FileNotFoundException --> which means the file is not in path, what is the path? it is a designer so some auto generated tem VS path that also tel us that that the assembly is not copied there from VS. Thats why I suggested u go with the XPand.ModelEditor which is a seperated from VS process and work in the project output path

nitrixHub commented 3 years ago

Thanks man, you are awesome tasker or an octopus attending your community, I will be glad to support you!.

Sure I did the homework (Path reviewed , got to this developer website, copied the assembly wherever is possible to look to for it, GAC , Windows\system32, Visual Studio) and event took it from the running copy of the lib, and it has been found, just not the type of lib is expecting.. HRESULT error. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040).... System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)

So might be related to a middle call in the process of displaying the visual tools and my setup...

From my little understanding the visual designer are the heart of the XAF or one of the attractive feature from DevExpress XAF.. in the sense of fast development with these 2 great libraries/frameworks, and not having to rely on the XML manual edition of it (at least at high level).

Regards.

NitrixHub

apobekiaris commented 3 years ago

u never answer me however what about the Xpand.ModelEditor does it work?

Thanks for the support!

apobekiaris commented 3 years ago

The located assembly's manifest definition does not match the assembly reference

my understanding is that u get the )Harmony form the Xpand.Patcher nuget or not?

nitrixHub commented 3 years ago

I got the lib from the Nuget directly (surely via its developer) and I suppose is there from legacy or because is called from Xpand, the visual tools from Xpand are not opening as well.. they show just transparent windows with decorations, it used to work when I had the local Xpand libraries (not the nuget packages), this is my second week trying to solve this puzzle heheh. at least is compiling and running.. but I still not confidend to go pre-prod.

apobekiaris commented 3 years ago

I got the lib from the Nuget directly (surely via its developer)

recalling my previous note

System.IO.FileNotFoundException: Could not load file or assembly '0Harmony, Version=2.0.4.0, Culture=neutral, PublicKeyToken=c52ffed5d5ff0958'

focus on this and analyze its word

it is not the same lib the Xpand.Patcher package contains a recompiled version of 0Harmoany

nitrixHub commented 3 years ago

Ok.. you manage to get it inside the mainstream libs.. that's a good solution I will try again, I remember I did it.. but I will try now with the NuGet Based solution.

apobekiaris commented 3 years ago

again I suggest u use the nugets as is and not mix match them with other versions u find around. The easytests run XAF applications like the user does for WinDesktop, WinForms, WebForms, Blazor. They consume the same packages, they are green.

nitrixHub commented 3 years ago

I got your suggestion and I went that way las week and that is why is compiling now..

I remove any reference of the 0Harmony lib (GAC, Nuget, Windows ... ) and I still got it loading the assembly while debugging IDK from where now. (specially on this module Xpand.Persistent.Base.General.XpandModuleBase ) meaning the Email module and Xpand Dashboard are affected (visual design), I had not learned the internals of Xpand yet maybe another one is triggering it at design time.

Still the same issue with the visual tools searching for the holly 0Harmony (now, I will try to remove any other non used libs)

apobekiaris commented 3 years ago

Harmony lib (GAC, Nuget, Windows ... )

no Xpand assemblies or dependecy should be in Gac and nothing more is todo than demoed in the video i posted b4 https://www.youtube.com/watch?v=LvxQ-U_0Sbg&t=1s

Does that setup works for you?

expand commented 11 months ago

Closing issue for age. Feel free to reopen it at any time.

.Thank you for your contribution.