Hello there.
I'm creating a .NET Framework Windows Forms project with MVVM capabilities and Microsoft DI Container (Microsoft.Extensions.Hosting + Microsoft.Extensions.DependencyInjection, version 6.0.0). After to resolve a few errors for accomplish the integration, I found an behavior that I can't resolve: When I configure the MVVMContextCompositionRoot.ViewModelCreate event on Program.cs or using MVVMContext.ViewModelCreate inside of the Views, all bindings and mappings maded inside of InitializeBindings method are ignore by the MVVM Framework.
I attached a solution with 2 projects, MVVMDI.NotError project is a demo project using Microsoft DI but without configure the ViewModelCreate event. In this case, the MVVM Framework respect all binding and mappings. In MVVMDI.WithError, I only added the ViewModelCreate event in Program.cs (used for generate my POCO ViewModels with/without dependencies) and the corresponding application not working.
I seen these posts about similar problems, but I they was not enough for find a solution:
Winforms MVVM, Autofac, and ViewModel Management | DevExpress Support
Dependency injection works in Debug build, but not in Release build | DevExpress Support
Hello,
Thank you for your sample. I reproduced this behavior. At present, I am working on the issue and need additional time. Once I get any results, I will share them with you.
Should you have additional questions, let me know.
Hello Alexey Z,
Are there some news about this issue? It's very important to me know if it's possible use DI and MVVM Framework, right now this problem it's a stopper in my current development.
Thank you for working on my issue.
Hello,
I understand how urgent this is for you. So, I personally contacted our developers in this regard. Once they have an approximate estimation for a fix or find a workaround, I will post a new comment in this thread.
Feel free to contact me if you have additional questions.