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.

ISupportInitialize.BeginInit/EndInit should be virtual

See original GitHub issue

Since View is intended to be heavily inherited to create new types of views, it would be quite convenient to be able to override BeginInit and EndInit, so that additional automatic initialization can be performed.

This is the typical pattern for interfaces that can be of use to derived classes (i.e. IDisposable and the virtual Dispose impl.).

If desired, the interface implementation can be made explicit and a protected virtual member can be exposed instead, to preserve the base class behavior even if overriden. The former is simpler, but the latter might be more solid if the base View performs critical work on its BeginInit/EndInit pair.

(I can send a PR with whichever approach is deemed more appropriate)

Issue Analytics

  • State:open
  • Created 10 months ago
  • Reactions:2
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
tznindcommented, Nov 19, 2022

These all sound like good solutions. I think I’ve been converted from my initial response and I’m now feeling that simplicity might be the best and simply marking them virtual as @kzu first suggested.

If someone forgets to call base.BeginInit then its not really our responsibility to complicate our API to prevent that. And it is the most flexible.

The OnInitializing bit seems like a nice addition too.

1reaction
BDispcommented, Nov 26, 2022

Wow @kzu great API packages you have done and doing, fantastic. Don’t give up creating useful libraries, please. Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to correctly override ISupportInitialize implementation
The problem is, that the interface is explicitly implemented from microsoft and so i cannot call the BeginInit() and EndInit() Methods of the ......
Read more >
BeginInit and EndInit creating errors
Recently I have been working on adding to my ribbon BarSubItem some buttons, and now one day when I tried to open the...
Read more >
BaseControlArray.ISupportInitialize.BeginInit Method
Using the BeginInit and ISupportInitialize.EndInit() methods prevents the control from being used before it is fully initialized.
Read more >
ISupportInitialize.BeginInit problems?
Fix an exception related to ISupportInitialize. ... This indicates that the BeginInit/EndInit calls are an optimization and it should be OK ...
Read more >
[RESOLVED] How to declare variables in "Initialization" ...
ISupportInitialize ).BeginInit() StateItem2.Mode = VisiWinNET.DataAccess.ItemMode.Value StateItem2.Name = "Ch1.Machine04.Application.
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