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

Have generated module interfaces inherit from IDisposable #249

Merged
merged 1 commit into from
Oct 11, 2024

Conversation

atifaziz
Copy link
Contributor

@atifaziz atifaziz commented Oct 10, 2024

The source generate implements the Dispose method for each generated module interface implementation:

public void Dispose()
{
logger.LogDebug("Disposing module {ModuleName}", "{{fileName}}");
{{ string.Join(Environment.NewLine, functionNames.Select(f => $"this.{f.Field}.Dispose();")) }}
module.Dispose();
}

Since it doesn't advertise that, the implementation is publicly unreachable and therefore it's impossible to dispose a module and free its memory. This PR fixes that by having module interfaces inherit from IDisposable.

@tonybaloney tonybaloney merged commit 4d35d8e into tonybaloney:main Oct 11, 2024
37 checks passed
@atifaziz atifaziz deleted the disposable-mod branch October 11, 2024 06:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants