Skip to content

AppDomain.Unload usage is deprecated and should be removed #15535

@adityapatwardhan

Description

@adityapatwardhan

As per, https://docs.microsoft.com/en-us/dotnet/fundamentals/syslib-diagnostics/syslib0024 the usage of AppDomain.Unload is deprecated and should be removed.

It is used at:

internal void ReleaseResponsibilityForModuleAnalysisAppDomain()
{
Diagnostics.Assert(_responsibilityForModuleAnalysisAppDomainOwned, "Invalid module analysis app domain state");
if (AppDomainForModuleAnalysis != null)
{
AppDomain.Unload(AppDomainForModuleAnalysis);
AppDomainForModuleAnalysis = null;
}
_responsibilityForModuleAnalysisAppDomainOwned = false;
}

As per discussion with @daxian-dbw the code is old and not used anymore and should be cleaned up.

Steps to reproduce

Compile code with .NET 6 preview 5 will throw a warning causing a build break: https://github.com/PowerShell/PowerShell/runs/2764430556?check_suite_focus=true#step:4:105

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Code Cleanupthe issue is for cleaning up the code with no impact on functionalityNeeds-TriageThe issue is new and needs to be triaged by a work group.Resolution-FixedThe issue is fixed.WG-Enginecore PowerShell engine, interpreter, and runtime

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions