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

NuGet library failing with "Invalid -v argument value" #177

Closed
scovetta opened this issue Mar 25, 2020 · 4 comments
Closed

NuGet library failing with "Invalid -v argument value" #177

scovetta opened this issue Mar 25, 2020 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@scovetta
Copy link
Member

Describe the bug
The AnalyzeCommand throws an OpException when used.

To Reproduce

        static void Main(string[] args)
        {
            AnalyzeCommandOptions options = new AnalyzeCommandOptions();
            AnalyzeCommand command = new AnalyzeCommand(options);
            options.SourcePath = ".";

            string result = command.GetResult(); //process results as desired
            Console.WriteLine(result);
        }

Exception trace:

 	ApplicationInspector.Commands.dll!Microsoft.ApplicationInspector.Commands.Utils.SetupLogging()	Unknown
 	ApplicationInspector.Commands.dll!Microsoft.ApplicationInspector.Commands.WriteOnce.SafeLog(string message, NLog.LogLevel logLevel)	Unknown
 	ApplicationInspector.Commands.dll!Microsoft.ApplicationInspector.Commands.AnalyzeCommand.ConfigOutput()	Unknown
 	ApplicationInspector.Commands.dll!Microsoft.ApplicationInspector.Commands.AnalyzeCommand.AnalyzeCommand(Microsoft.ApplicationInspector.Commands.AnalyzeCommandOptions opt)	Unknown
>	TestAI1.dll!TestAI1.Program.Main(string[] args) Line 11	C#

I believe this might be due to the LogFileLevel not being assigned in AnalyzeCommand.cs

Additional context
Using the NuGet version 1.1.21 on .NET Core 3.1

@scovetta scovetta added the bug Something isn't working label Mar 25, 2020
@guyacosta
Copy link
Contributor

investigating

@guyacosta
Copy link
Contributor

guyacosta commented Mar 25, 2020

The first issue is the call order above does not set the source path in the options object before passing it to the analyzecommand constructor :).

        AnalyzeCommandOptions options = new AnalyzeCommandOptions();
        options.SourcePath = "."; //all values should be initialized before passing to the command
        AnalyzeCommand command = new AnalyzeCommand(options);
        
        string result = command.GetResult(); //process results as desired
        Console.WriteLine(result);

So as it was used, it will throw an exception on the directory or file being invalid which is correct but I can clarify the log error since there will be no file name to report to help. In addition I did find the log level was not set by default which could cause an issue. The logging setup path changed recently. High priority on next fix after this is missing unit tests to avoid missing a test path.

@scovetta
Copy link
Member Author

Thanks! If you send me over a .nupkg I can test it locally to make sure we're good.

@guyacosta
Copy link
Contributor

Will do. Just improving the error msg on null source file for clarify in log -2 minutes.

guyacosta pushed a commit that referenced this issue Mar 25, 2020
guyacosta added a commit that referenced this issue Mar 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants