Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

INavigationParameters location + Prism 7.2 support changes #2

Open
keozx opened this issue Jul 19, 2019 · 10 comments
Open

INavigationParameters location + Prism 7.2 support changes #2

keozx opened this issue Jul 19, 2019 · 10 comments

Comments

@keozx
Copy link

keozx commented Jul 19, 2019

Hi @duanenewman testing this I found an issue trying to use the VerifyNavigation() saying

error CS7069: Reference to type 'INavigationParameters' claims it is defined in 'Prism', but it could not be found

Tried to use this I found in your blog

<PackageReference Include="Prism.Core"  GeneratePathProperty="true" Version="7.2.0.1347-pre" ExcludeAssets="Compile"/>
...
And...
      <Reference Include="Prism">
      <HintPath>$(PkgPrism_Core)lib\netstandard2.0\Prism.dll</HintPath>
    </Reference>

But still can't find it, any suggestions? though this should not be needed since is still same netstandard

Thanks!

@keozx
Copy link
Author

keozx commented Jul 20, 2019

Ouch, tracked down to this change in 7.2 Prism PrismLibrary/Prism#1348 I'm starting to use some features of 7.2 so I'll investigate why this breaks netcoreapp project

@keozx
Copy link
Author

keozx commented Jul 20, 2019

Oh this should be just because you are using 7.1 on Ease.NUnit.DryIoc.PrismForms, so I need to take the source and make it target 7.2 because of this INavigationParameters change :)

@keozx
Copy link
Author

keozx commented Jul 20, 2019

Ok that worked, probably it would be a good a idea to have a pre-release nuget with the Prism 7.2-pre references? For now I forked and fixed here https://github.com/keozx/Ease

@keozx keozx closed this as completed Jul 20, 2019
@duanenewman
Copy link
Member

Another thing to be aware of, if you were using .NET framework for a Prism.Forms test project you may get the wrong Prism library (WPF version). Use .NET Core for the test app to get the netstandard version of the prism libraries. I'll take a look at your fork, and look into a pre-release build.

@keozx
Copy link
Author

keozx commented Jul 22, 2019

There is also an issue with Navigation in 7.2 :/ changed INavigationService methods to extensions of INavigationServiceExtensions PrismLibrary/Prism@753fe5a

Getting
Exception thrown: 'System.InvalidCastException' in Prism.Forms.dll An exception of type 'System.InvalidCastException' occurred in Prism.Forms.dll but was not handled in user code Unable to cast object of type 'Castle.Proxies.INavigationServiceProxy' to type 'Prism.Navigation.IPlatformNavigationService'.

Looking into it...

@keozx keozx changed the title INavigationParameters location INavigationParameters location + Prism 7.2 support changes Jul 23, 2019
@keozx
Copy link
Author

keozx commented Jul 23, 2019

Ok so I fixed it (for now) I'll leave this open in case I come across another issue, basically what happens is that internally while navigating is using the new interface IPlatformNavigationService due the alignment of APIs, I changed the mock registration like this:

OnINavigationServiceMockCreated = (m) => m.As<IPlatformNavigationService>();
RegisterMockType(() => OnINavigationServiceMockCreated);

For the VerifyNavigation methods I had to treat INavigationServic as IPlatformNavigationService

var navServiceMock = Mock.Get(ResolveType<INavigationService>()).As<IPlatformNavigationService>();

Because this interface does not provide the optional parameters for some reason had to add those to every method like:

navServiceMock.Verify(n => (n.NavigateAsync(path, It.IsAny<INavigationParameters>(), It.IsAny<bool>(), It.IsAny<bool>())), times);

With this the verifynavigation() now works
I have also pushed these changes in the fork, I think this can be simplified somehow like having the optional parameters...

@keozx keozx reopened this Jul 23, 2019
@duanenewman
Copy link
Member

Upgrading the Prism (and other references) is on my short term list. Hoping to have a lot of updates coming soon.

@Samit-BTE
Copy link

It would be nice if you can upgrade to PRISM 8 preview, it has support for Xamarin 4.6 and a few of breaking changes.

@duanenewman
Copy link
Member

once I get all the appveyor/build stuff figured out I may create a preview branch to build preview builds with support

@chowarth
Copy link
Contributor

chowarth commented Jun 5, 2020

I believe now that #4 has been merged in, once a new version has been released, the workaround mentioned by @keozx above will no longer be necessary as all Prism navigation extension methods should now be supported out of the box.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants