NetCore 3.1 - Error then show MainView
Closed this issue · 10 comments
If there are no registered resources the ViewReolver
fails because of a NRE at
resourcesRegistrationHolder.Registrations
is null.
Hi Mauro, i'm starting to test Radical with NetCore 3.1,
1)I have create my first new project in NetCore 3.1
2)Install from NuGet Radical (2.0.0-Beta6) and Radical.Windows(2.0.0-Beta9)
3)I create the Folder Presentation and MainView and MainViewModel
4)In App.cs i have change the old
ApplicationBootstrapper bootstrapper = new WindsorApplicationBootstrapper<MainView>();
width
ApplicationBootstrapper bootstrapper = new ApplicationBootstrapper<MainView>();
The project run, the constructor of MainViewModel is execute OK, but the View is not Show, i have the error:
System.NullReferenceException
HResult=0x80004003
Message=Object reference not set to an instance of an object.
Source=Radical.Windows
StackTrace:
at Radical.Windows.Services.ViewResolver.ExposeRegisteredResourcesIfAny(DependencyObject view)
at Radical.Windows.Services.ViewResolver.GetView(Type viewType, Action`1 viewModelInterceptor)
at Radical.Windows.Services.ViewResolver.GetView(Type viewType)
at Radical.Windows.ApplicationBootstrapper.<>c__DisplayClass41_0.g__showShell|1()
at Radical.Windows.ApplicationBootstrapper.OnBootCompleted(IServiceProvider serviceProvider)
at Radical.Windows.ApplicationBootstrapper.OnBoot()
at Radical.Windows.ApplicationBootstrapper.<.ctor>b__16_0(Object s, StartupEventArgs e)
at System.Windows.Application.OnStartup(StartupEventArgs e)
at System.Windows.Application.<.ctor>b__1_0(Object unused)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.Run()
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run()
at WpfApp2.App.Main() in D:\Progetti Test\WpfApp2\WpfApp2\obj\Debug\netcoreapp3.1\App.g.cs:line 52
This exception was originally thrown at this call stack:
Radical.Windows.Services.ViewResolver.ExposeRegisteredResourcesIfAny(System.Windows.DependencyObject)
Radical.Windows.Services.ViewResolver.GetView(System.Type, System.Action)
Radical.Windows.Services.ViewResolver.GetView(System.Type)
Radical.Windows.ApplicationBootstrapper.OnBootCompleted.__showShell|1()
Radical.Windows.ApplicationBootstrapper.OnBootCompleted(System.IServiceProvider)
Radical.Windows.ApplicationBootstrapper.OnBoot()
Radical.Windows.ApplicationBootstrapper..ctor.AnonymousMethod__16_0(object, System.Windows.StartupEventArgs)
System.Windows.Application.OnStartup(System.Windows.StartupEventArgs)
System.Windows.Application..ctor.AnonymousMethod__1_0(object)
System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, object, int)
...
[Call Stack Truncated]
I don't know if I'm wrong something (it's the first Net.Core project) or I'm wrong the boot command.
Many Thanks
@Aurelio67 thanks for raising this. I don't think you're doing anything wrong, I'll have a look at this soon.
In the meantime, I moved the issue to the Radical.Windows
repository as I have a hunch of what the problem might be looking at the stack trace.
ok, if it is not a problem I will point out everything that does not work for me by passing a framework project with a core with radical, then when you can you will answer me without haste.
Come al solito grazie..
Absolutely, go on raising issues as you face them.
I've found the bug, that was quick 😄
If there are no registered resources the ViewReolver
fails because of a NRE at
resourcesRegistrationHolder.Registrations
is null. There a few ways to fix this, I'll write a test first.
Yeah...
When you have solved I proceed with the conversion so I can see if everything works as in the project with the framework.
Thanks.
Raised #201 to start addressing this.
@Aurelio67 2.0.0-Beta.10
is going to on Nuget soon, can you give it a try?
Of course, as soon as you release it I try it right away
It’s available on nuget
Yeah great ... it's work OK, now I will proceed with the other options (IMessageBroker, IConventionHandler, etc.) slowly I do the conversion and if I find problems I will write to you.
Thanks