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.

[Request] Allow self-registration of handlers, etc.

See original GitHub issue

Description

Imagine a library with a big amount of handlers, effects, etc.

  • If a client-dev wants to use the components - he needs to put a lot of code in the CreateMauiApp() method. If the client-dev uses a NuGet - it will not be obvious that there is an additional step he needs to do to get the components working.
  • We can implement a single UseLibrary() extension method, but there are huge consequences for using such an approach. The problem is as follows - in the UseLibrary() method, we need to register everything - all handlers, renderers, effects, everything. Now the linker will not be able to strip away unused code - even if the client-dev uses only a couple of our controls.
  • It will be very useful if we can introduce a property in the MauiApp class that will allow to dynamically register a handler. For example, the static constructor of a Component1 can execute a call like MauiApp.Current.TryAddHandler(Component1, Component1Handler). This way if a client-dev uses Component1 - the handler will be registered automatically. If the client-dev does not use it - the linker would be able to properly strip away the component and the handler. Note that the name of the method is TryAddHandler() - so it can check if a handler was already registered for this type and not overwrite it.

Public API Changes

We have to analyze possibilities to allow this.

Intended Use-Case

MauiApp.Current.TryAddHandler(Component1, Component1Handler)

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:15
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

5reactions
dotMortencommented, Jun 6, 2022

I support this 1000%. I’m already time after time again seeing people not understanding why our controls don’t work, simply because they didn’t know they needed to call some obscure UseXxx() method in the builder. While I get the technical reason for it, it is incredibly developer unfriendly for 3rd party component customers.

1reaction
msftbot[bot]commented, Jul 11, 2023

We’ve added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Self Registration Configuration
Self registration in midPoint provides possibility for unauthenticated user to enroll to midPoint and request assignments. By default, self ...
Read more >
Pattern: Self Registration
A service instance that is running yet unable to handle requests will often lack the self-awareness to unregister itself from the service registry....
Read more >
Authentication FAQ
General Questions. What is an authentication plugin? An authentication plugin is a method of handling user authentication to Moodle when ...
Read more >
Configure Your Self-Registration Page
Under Registration Page Configuration, select Allow customers and partners to self-register. If users attempt to register with a duplicate username, they ...
Read more >
Self registration does not work - Installation Issues
self-registration was working for us, but it suddenly stopped. ... [WARN] The passbolt config file is missing in /etc/passbolt/
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