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

(#886, 2693) Update packages.config install logging and add back resolve or load method for Assembly Resolution #2836

Merged
merged 2 commits into from
Oct 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ private IEnumerable<ChocolateyConfiguration> get_packages_from_config(string pac

this.Log().Info(ChocolateyLoggers.Important, @"{0}".format_with(packageConfig.PackageNames));
packageConfigs.Add(packageConfig);
this.Log().Debug(() => "Package Configuration: {0}".format_with(packageConfig.ToString()));
this.Log().Debug(() => "Package Configuration Start:{0}{1}{0}Package Configuration End".format_with(System.Environment.NewLine, packageConfig.ToString()));
}
}

Expand Down
12 changes: 12 additions & 0 deletions src/chocolatey/infrastructure/registration/AssemblyResolution.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@ public class AssemblyResolution

private static readonly ConcurrentDictionary<string, IAssembly> _loadedAssemblies = new ConcurrentDictionary<string, IAssembly>();

/// <summary>
/// Resolves or loads an assembly. If an assembly is already loaded, no need to reload it.
/// </summary>
/// <param name="assemblySimpleName">Simple Name of the assembly, such as "chocolatey"</param>
/// <param name="publicKeyToken">The public key token.</param>
/// <param name="assemblyFileLocation">The assembly file location. Typically the path to the DLL on disk.</param>
/// <returns>An assembly</returns>
/// <exception cref="Exception">Unable to enter synchronized code to determine assembly loading</exception>
public static IAssembly resolve_or_load_assembly(string assemblySimpleName, string publicKeyToken, string assemblyFileLocation) {
gep13 marked this conversation as resolved.
Show resolved Hide resolved
return resolve_or_load_assembly(assemblySimpleName, publicKeyToken, assemblyFileLocation, false);
}

/// <summary>
/// Resolves or loads an assembly. If an assembly is already loaded, no need to reload it.
/// </summary>
Expand Down
8 changes: 5 additions & 3 deletions tests/chocolatey-tests/commands/choco-install.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,11 @@ Describe "choco install" -Tag Chocolatey, InstallCommand {
$Output = Invoke-Choco install $env:CHOCOLATEY_TEST_PACKAGES_PATH\alloptions.packages.config --confirm --verbose --debug

# This is based on two observations: The addition explicitly outputs that it's the Package Configuration.
# The configuration output is also about 80 lines.
$StartofPackageConfiguration = [array]::IndexOf($Output.Lines, "Package Configuration: CommandName='install'|")
$PackageConfigurationOutput = $Output.Lines[$StartofPackageConfiguration..($StartofPackageConfiguration+80)] -join [Environment]::NewLine
# The configuration output is about 80 lines.
$StartOfPackageConfiguration = [array]::IndexOf($Output.Lines, "Package Configuration Start:")
$EndOfPackageConfiguration = [array]::IndexOf($Output.Lines, "Package Configuration End")
AdmiringWorm marked this conversation as resolved.
Show resolved Hide resolved

$PackageConfigurationOutput = $Output.Lines[$StartofPackageConfiguration..$EndOfPackageConfiguration] -join [Environment]::NewLine
}

# We are explicitly passing in a bad username and password here.
Expand Down