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

Tool access denied to path #1490

Closed
BernieWhite opened this issue Mar 28, 2023 · 0 comments · Fixed by #1507
Closed

Tool access denied to path #1490

BernieWhite opened this issue Mar 28, 2023 · 0 comments · Fixed by #1507
Assignees
Labels
bug Something isn't working feature: core Issues that affect the core engine
Milestone

Comments

@BernieWhite
Copy link
Member

Description of the issue

If access to a path is denied the PSRule CLI tool terminate with an exception. This should be better handled.

Error output

Unhandled exception: System.UnauthorizedAccessException: Access to the path 'C:\Users\nnn\Application Data' is denied.
   at System.IO.Enumeration.FileSystemEnumerator`1.CreateRelativeDirectoryHandle(ReadOnlySpan`1 relativePath, String fullPath)
   at System.IO.Enumeration.FileSystemEnumerator`1.MoveNext()
   at PSRule.Pipeline.PathBuilder.FindFiles(String path) in /_/src/PSRule/Pipeline/PathBuilder.cs:line 98
   at PSRule.Pipeline.PathBuilder.Add(String[] path) in /_/src/PSRule/Pipeline/PathBuilder.cs:line 67
   at PSRule.Pipeline.InvokePipelineBuilderBase.InputPath(String[] path) in /_/src/PSRule/Pipeline/InvokePipelineBuilder.cs:line 63
   at PSRule.Tool.ClientHelper.RunAnalyze(AnalyzerOptions operationOptions, ClientContext clientContext, InvocationContext invocation) in /_/src/PSRule.Tool/ClientHelper.cs:line 29
   at PSRule.Tool.ClientBuilder.<AddAnalyze>b__14_0(InvocationContext invocation) in /_/src/PSRule.Tool/ClientBuilder.cs:line 97
   at System.CommandLine.Invocation.AnonymousCommandHandler.Invoke(InvocationContext context)
   at System.CommandLine.Invocation.AnonymousCommandHandler.InvokeAsync(InvocationContext context)
   at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass17_0.<<UseParseErrorReporting>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass12_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<<UseVersionOption>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass19_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__18_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass16_0.<<UseParseDirective>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__5_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass8_0.<<UseExceptionHandler>b__0>d.MoveNext()

Module in use and version:

  • Module: PSRule
  • Version: 2.8.0
@BernieWhite BernieWhite added bug Something isn't working feature: core Issues that affect the core engine labels Mar 28, 2023
@BernieWhite BernieWhite self-assigned this Apr 22, 2023
@BernieWhite BernieWhite added this to the v2.9.0 milestone Apr 22, 2023
BernieWhite added a commit to BernieWhite/PSRule that referenced this issue Apr 22, 2023
@BernieWhite BernieWhite mentioned this issue Jun 8, 2023
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working feature: core Issues that affect the core engine
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant