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

Remove Routing with a Fully Qualified Type name #5045

Merged
merged 4 commits into from
Mar 4, 2022

Conversation

eerhardt
Copy link
Member

@eerhardt eerhardt commented Mar 3, 2022

This behavior is not trim-compatible, since it just a random string "route name" and calls Type.GetType with it, and then Activator.CreateInstance. The trimmer might have removed the whole type, or even the constructor on the Type. This would cause a trimmed application to behave differently than an untrimmed application.

I do not know of anyone who relies on this behavior, and there are no tests for it. So removing it seems like the best path forward.

Contributes to #1962

This behavior is not trim-compatible, since it just a random string "route name" and calls Type.GetType with it, and then Activator.CreateInstance. The trimmer might have removed the whole type, or even the constructor on the Type. This would cause a trimmed application to behave differently than an untrimmed application.

I do not know of anyone who relies on this behavior, and there are no tests for it. So removing it seems like the best path forward.

Contributes to dotnet#1962
Comment on lines -147 to -164
// okay maybe its a type, we'll try that just to be nice to the user
var type = Type.GetType(route);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think anyone would use a route like:

app://home/MyAssemblyName, MyNamespace.MyPageName

The space, comma, and dot would make this a very weird URL.

@jonathanpeppers
Copy link
Member

Looks like this needs to delete a test, though:

GlobalRouteWithDependencyResolution(Microsoft.Maui.Controls.Core.UnitTests.ShellTestBase+PageWithDependency,Microsoft.Maui.Controls.Core.UnitTests.ShellTestBase+Dependency)

@jsuarezruiz
Copy link
Contributor

Right, the build is failing because of this test.

@Redth Redth enabled auto-merge (squash) March 4, 2022 15:32
@@ -623,57 +623,6 @@ public async Task RouteWithGlobalPageRoute()
Assert.AreEqual("//animals/domestic/cats/catdetails", shell.CurrentState.Location.ToString());
}

[TestCase(typeof(PageWithDependency), typeof(PageWithDependency))]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we want to fully remove this test. Let me fix

@Redth Redth merged commit bf078f5 into dotnet:main Mar 4, 2022
@eerhardt eerhardt deleted the RemoveTypeRouting branch March 4, 2022 19:11
@samhouts samhouts added area-controls-shell Shell Navigation, Routes, Tabs, Flyout t/app-size Application Size / Trimming (sub: perf) labels Jul 20, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Dec 21, 2023
@Eilon Eilon added the area-publishing Issues with the app packaging/publishing process (ipk/apk/msix/trimming) label May 10, 2024
@samhouts samhouts added the fixed-in-6.0.300-rc.1 Look for this fix in 6.0.300-rc.1! label Aug 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-shell Shell Navigation, Routes, Tabs, Flyout area-publishing Issues with the app packaging/publishing process (ipk/apk/msix/trimming) fixed-in-6.0.300-rc.1 Look for this fix in 6.0.300-rc.1! t/app-size Application Size / Trimming (sub: perf)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants