Skip to content

[BUG] RegisterViewsForViewModels throws System.InvalidOperationException: "Sequence contains no matching element" #2437

@mmuecke

Description

@mmuecke

Describe the bug
Locator.CurrentMutable.RegisterViewsForViewModels(AssemblyType); throws this excpetion

System.InvalidOperationException
HResult=0x80131509
Nachricht = Sequence contains no matching element
Quelle = System.Linq
Stapelüberwachung:
at System.Linq.ThrowHelper.ThrowNoMatchException()
at System.Linq.Enumerable.First[TSource](IEnumerable1 source, Func2 predicate)
at ReactiveUI.DependencyResolverMixins.TypeFactory(TypeInfo typeInfo) in d:\a\1\s\src\ReactiveUI\Mixins\DependencyResolverMixins.cs:line 109
at ReactiveUI.DependencyResolverMixins.RegisterViewsForViewModels(IMutableDependencyResolver resolver, Assembly assembly) in d:\a\1\s\src\ReactiveUI\Mixins\DependencyResolverMixins.cs:line 88
at MyApp.App.d__1.MoveNext() in C:\xyz

Steps To Reproduce

  • I don't know how to reproduce the exception. I will give more information if I find the code braking it. I just made some minor changes in the code. Even not adding IViewFor<> or so.
  • I tryed another assembly with no view models, there no exception in thrown.
  • The code already run successful

Expected behavior

  • Cache the exception and go on normal
  • Throw a more meaningful exception

Code
Here is the line of code:

return Expression.Lambda<Func<object>>(Expression.New(

Environment

  • OS: Win 10 VS 2019 V16.6.0
  • Version .net core 3.1, ReactiveUI WPF 11.4.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions