Page MenuHomePhabricator

C#: Deprecate usage of explicit `Init()/Shutdown` functions in favor of `Csharp.Application`
Open, HighPublic

Description

Current approach

Currently C# has two ways of starting an application:

  • Using explicit Foo.Init()/Foo.Shutdown() calls, similar to old-style code.
  • Using Efl.Csharp.Application, which works in a similar way to ELM_MAIN, like in:
public MyApp : Efl.Csharp.Application {
    public override void OnInitialize(String[] args) {
       // Build widgets here
    }

    public static void Main() {
        varr app = new MyApp();
        app.Launch();
    }
}

Proposal

  • Mark the usage of Init() outside the CSharp.Application context with a deprecation warning for a grace period while exiting examples and tests are updated.
  • As soon as possible (Before 1.24 freeze?) make these methods internal (as they are used inside Application).
lauromoura triaged this task as High priority.

Just a thought: What if the user's application cannot inherit from our Efl.Csharp.Application because it already must inherit from another class?
Due to another library's restriction, for example.

Just a thought: What if the user's application cannot inherit from our Efl.Csharp.Application because it already must inherit from another class?
Due to another library's restriction, for example.

I am also a bit worried this point. There can be a case that it is impossible to inherit from the Application class.

Well, if you need to use another lib that you need to init, then you can just do it in Efl.Csharp.Application, or in the main method, and later on call launch. So this is not a problem ? (If the other lib also needs to have a mainloop running, than this is not going to work anyways, as efl needs to do that, no matter if you use Efl.Csharp.Application, or Foo.Init() )