question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

FreshPageModelResolver fails to Resolve type if "Models" keyword is present on the name space

See original GitHub issue

Giving the following example:

namespace Foo.Bar.PageModels
{
    public class MyPageViewModel
    {
       ...
    }
}

Using var name = type.AssemblyQualifiedName.Replace ("Model", string.Empty); Will lead into the follow type: Foo.Bar.Pages.MyPageView witch does not exist.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
escamoteurcommented, Feb 16, 2016

I just ran into a very similiar Problem. If my Pages were not in the same namespace as the pagemodels I got this exception:

02-16 21:07:30.833 D/Mono    ( 3420): Assembly Ref addref FreshMvvm[0xb7f27960] -> FreshIOC[0xb7f26998]: 2
Error while resolving expression: Object reference not set to an instance of an object.
Unhandled Exception:

System.Exception: BREADy.Pages.MainMenuPage, BREADy, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null not found

Error while resolving expression: Object reference not set to an instance of an object.
Error while resolving expression: Object reference not set to an instance of an object.
Error while resolving expression: Object reference not set to an instance of an object.
Error while resolving expression: Object reference not set to an instance of an object.
Error while resolving expression: Object reference not set to an instance of an object.
02-16 21:07:30.833 D/Mono    ( 3420): Assembly Ref addref FreshMvvm[0xb7f27960] -> FreshIOC[0xb7f26998]: 2
Error while resolving expression: Object reference not set to an instance of an object.
Unhandled Exception:

System.Exception: BREADy.Pages.MainMenuPage, BREADy, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null not found

Error while resolving expression: Object reference not set to an instance of an object.
Error while resolving expression: Object reference not set to an instance of an object.
Error while resolving expression: Object reference not set to an instance of an object.
Error while resolving expression: Object reference not set to an instance of an object.
Error while resolving expression: Object reference not set to an instance of an object.

More specifically, It does works if both are in the same namespace OR if pages are in a sub-name space “Pages” and page models ins "PageModels.

0reactions
rid00zcommented, Aug 24, 2016

@Looooooka FreshMvvm now supports ability to use a custom naming convention, see http://www.michaelridland.com/xamarin/announcing-freshmvvm-2-1-and-2-2/

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error on FreshPageModelResolver.ResolvePageModel<>()
It means after replace ViewModel to Page, the name (AssemblyQualifiedName of MainPage) could not get the right type of MainPage. So it thrown ......
Read more >
Resolve failed: APageModel - Xamarin.Forms
I am using the new .Net standard type of Xamarin projects. Here is my app.xaml.cs: public App() { InitializeComponent(); MainPage = FreshMvvm.
Read more >
Error: The type or namespace name Models does not exist in ...
https://codedocu.com/Details?d=2807&a=9&f=344&l=0 Asp Core Error : The type or namespace name 'ArticleModels' does not exist in the namespace ...
Read more >
XAML namespaces - .NET MAUI
There are two XAML namespace declarations that are always within the root element of a XAML file. The first defines the default namespace:....
Read more >
The type or namespace name 'System' could not be found
When I try to create a new Xamarin Forms app, nothing works. No imports can be found. Almost every line in the autogenerated...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found