Skip to content

Additional logging around packages.config paths during project inspection #25

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

shantyk
Copy link
Collaborator

@shantyk shantyk commented Feb 5, 2025

In an attempt to debug an issue that is only producible on user's system, this branch adds some logging around parts of the code that are relevant for packages.config inspection. The output logs hope to shine light on what could be causing the issue and is just testing a couple of theories.

Steps to run NuGet Inspector standalone in an IDE where debugging is not limited to the log msgs in this MR: (recommended)

  1. Clone this repo and checkout this branch (or download the ZIP)

  2. Open it in your favourite IDE (for example Rider)

  3. Edit your run configurations to set the following program arguments:
    --target_path=/path/to/your/nuget/project (same as detect.source.path)
    --output_directory=/path/to/output/dir (this is where you will see a JSON file that summarizes the dependencies found)
    --excluded_modules=PackageExplorer,Core,Types

  4. Run it as is to see what additional info the added logs can shine light on OR run it in debug mode for a deeper dive. (potentially with someone from the Detect development team)

Steps to run NuGet Inspector standalone from source:

  1. Clone this repo and checkout this branch (or download the ZIP)

  2. Run dotnet publish -c Release -r win-x64 --self-contained true

  3. Navigate to the publish folder (will be given in the above commands output)

  4. Run the detect-nuget-inspector.exe with the following arguments:
    --target_path=/path/to/your/nuget/project (same as detect.source.path)
    --output_directory=/path/to/output/dir (this is where you will see a JSON file that summarizes the dependencies found)
    --excluded_modules=PackageExplorer,Core,Types

  5. This option is limited to only output the logs added in this MR.

@shantyk shantyk self-assigned this Feb 5, 2025
@shantyk shantyk changed the title Add logging around packagesconfig file permissions Additional logging around packages.config paths during project inspection Feb 5, 2025
Console.WriteLine($"Unable to find packages config file: {Options.PackagesConfigPath}. Checking if file permissions were denied...");
CheckFilePermissions(Options.PackagesConfigPath);
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This addition is to check the theory that file permissions could be an issue.

@@ -364,6 +389,7 @@ public bool IsExcluded()

private string CreateProjectPackageConfigPath(string projectDirectory)
{
Console.WriteLine($"Creating packages.config path from project directory: {projectDirectory}");
return PathUtil.Combine(projectDirectory, "packages.config");
Copy link
Collaborator Author

@shantyk shantyk Feb 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This addition is to check/highlight the theory that the file path origin could be the issue.

@shantyk shantyk requested a review from devmehtabd February 5, 2025 14:27
@shantyk shantyk removed the request for review from devmehtabd February 20, 2025 11:34
…ining customer logs + check for file permissions in relevant places.
@shantyk shantyk force-pushed the dev/shanty/IDETECT-4588-debugging branch from e30b3a4 to a91fdf1 Compare February 20, 2025 11:38
@@ -116,11 +116,16 @@ public Container GetContainer()
.Where(group => group.Count() > 1)
.Select(group => group.Key);

Console.WriteLine("Processing project files found in solution file.");
Copy link
Collaborator Author

@shantyk shantyk Feb 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect the problem has to do with the project paths given in their solution file, added further logging in this area to check that (included in exe attached to ticket on Feb 20)

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.

1 participant