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

System.IO.IOException: Cannot create 'xxxxxx' because a file or directory with the same name already exists. #3072

Closed
greenozon opened this issue Aug 30, 2023 · 2 comments
Labels

Comments

@greenozon
Copy link

Steps to reproduce

  1. save as project

Error message shown

System.IO.IOException: Cannot create 'C:\Tmp\delme now\ILer\-' because a file or directory with the same name already exists.
   at System.IO.FileSystem.CreateDirectory(String fullPath, Byte[] securityDescriptor)
   at System.IO.Directory.CreateDirectory(String path)
   at ICSharpCode.Decompiler.CSharp.ProjectDecompiler.WholeProjectDecompiler.<>c__DisplayClass46_0.<WriteCodeFilesInProject>g__GetFileFileNameForHandle|2(TypeDefinitionHandle h) in /_/ICSharpCode.Decompiler/CSharp/ProjectDecompiler/WholeProjectDecompiler.cs:line 247
   at System.Linq.Lookup`2.Create(IEnumerable`1 source, Func`2 keySelector, IEqualityComparer`1 comparer)
   at System.Linq.GroupedEnumerable`2.ToList()
   at ICSharpCode.Decompiler.CSharp.ProjectDecompiler.WholeProjectDecompiler.WriteCodeFilesInProject(PEFile module, IList`1 partialTypes, CancellationToken cancellationToken) in /_/ICSharpCode.Decompiler/CSharp/ProjectDecompiler/WholeProjectDecompiler.cs:line 214
   at ICSharpCode.Decompiler.CSharp.ProjectDecompiler.WholeProjectDecompiler.DecompileProject(PEFile moduleDefinition, String targetDirectory, TextWriter projectFileWriter, CancellationToken cancellationToken) in /_/ICSharpCode.Decompiler/CSharp/ProjectDecompiler/WholeProjectDecompiler.cs:line 154
   at ICSharpCode.ILSpy.CSharpLanguage.DecompileAssembly(LoadedAssembly assembly, ITextOutput output, DecompilationOptions options)
   at ICSharpCode.ILSpy.TreeNodes.AssemblyTreeNode.Decompile(Language language, ITextOutput output, DecompilationOptions options)
   at ICSharpCode.ILSpy.TextView.DecompilerTextView.DecompileNodes(DecompilationContext context, ITextOutput textOutput)
   at ICSharpCode.ILSpy.TextView.DecompilerTextView.<>c__DisplayClass65_0.<SaveToDiskAsync>b__0()

Details

  • ILSpy version 8.1.0.7490
    *.NET version 6.0.20-servicing.23320.17+a08d9ce2caf02455c0b825bcdc32974bdf769a80

test-p1.zip

@greenozon greenozon added the Bug label Aug 30, 2023
@greenozon
Copy link
Author

Still reproduced on

  • ILSpy version 9.0.0.7612-preview1
  • .NET version 8.0.3+9f4b1f5d664afdfc80e1508ab7ed099dff210fbd

@siegfriedpammer how about ILSpy will not try to create dir if it already exists?

@siegfriedpammer
Copy link
Member

According to the documentation, the Directory.CreateDirectory method only creates the directory if it does not already exist, so this exception is not telling us, that the directory already exists, but it seems that a file with that name already exists and there is something else going on.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 30, 2024
mattsh247 pushed a commit to mattsh247/ILSpy that referenced this issue Jul 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants