Skip to content

Should IRenderFragment.Dispose also dispose the wrapped component #640

Answered by egil
linkdotnet asked this question in Q&A
Discussion options

linkdotnet
Feb 21, 2022
Maintainer Sponsor

You must be logged in to vote

Since IRenderedFragmentBase already implements IDisposable, and could be made to implement IAsyncDisposable, its not a bad idea to support triggering the CUT's dispose method, if any, that way.

Without further design/analysis my idea to support this is:

  1. All RenderFragments are rendered inside the WrapperComponent in bUnit.
  2. If WrapperComponent gets support to remove whatever RenderFragment it has been passed from the render tree again, then the Blazor renderer will take care of any disposing that is needed.
  3. So we need a way from the IRenderedFragmentBase to get to the root WrapperComponent and calling a method on it during a call to the IRenderedFragment.Dispose method.
  4. After the Dispose

Replies: 4 comments 7 replies

Comment options

linkdotnet
Feb 21, 2022
Maintainer Author Sponsor

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by linkdotnet
Comment options

linkdotnet
Feb 23, 2022
Maintainer Author Sponsor

You must be logged in to vote
3 replies
@linkdotnet
Comment options

linkdotnet Feb 23, 2022
Maintainer Author Sponsor

@egil
Comment options

egil Feb 23, 2022
Maintainer

@linkdotnet
Comment options

linkdotnet Feb 24, 2022
Maintainer Author Sponsor

Comment options

linkdotnet
Feb 23, 2022
Maintainer Author Sponsor

You must be logged in to vote
4 replies
@egil
Comment options

egil Feb 23, 2022
Maintainer

@linkdotnet
Comment options

linkdotnet Feb 24, 2022
Maintainer Author Sponsor

@egil
Comment options

egil Feb 24, 2022
Maintainer

@linkdotnet
Comment options

linkdotnet Feb 24, 2022
Maintainer Author Sponsor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants