cart: empty [ Login ]

Problem loading drawing - DirectoryNotFoundException

1 2  next > 
LYoung
2/27/2019 9:03 PM
When loading a drawing, I am receiving the following error:
C# Code:
System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\magicvc'. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileSystemEnumerableIterator`1.CommonInit() at System.IO.FileSystemEnumerableIterator`1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler`1 resultHandler, Boolean checkHost) at System.IO.Directory.GetFiles(String path, String searchPattern) at WW.IO.DirectoryUtil.?(String ?, String ?, Queue`1 ?) at WW.IO.DirectoryUtil.SearchFile(String directory, String searchPattern, SearchOption searchOption) at WW.Drawing.FontFromDirectoryFileLoader.GetFullFileName(String directory, String fontFilename, SearchOption searchOption) at WW.Drawing.FontFromCurrentDirectoryFileLoader.Exists(String fontFilename) at ?.?(String ??, IList`1 ??) at WW.Cad.Model.Entities.ShxFile.?(String ?, IList`1 ?, String& ?) at WW.Cad.Model.Entities.ShxFile.?(String ?, IList`1 ?) at WW.Cad.Model.DxfModel.?(String ?) at ?.get_?() at ?..ctor(? ?) at ?.?(String ?, Double ?, Double ?, AttachmentPoint ?, Double ?, LineSpacingStyle ?, DxfTextStyle ?, Double ?, Color ?, DrawingDirection ?, String& ?) at ?.?(String ?, Double ?, Double ?, AttachmentPoint ?, Double ?, LineSpacingStyle ?, DxfTextStyle ?, Double ?, Color ?, DrawingDirection ?, Int16 ?, Matrix4D ?, ? ?, ? ?) at ?.?(DxfModel ?, DxfMText ?, Color ?, Int16 ?, Matrix4D ?, Bounds2D ?) at WW.Cad.Model.Entities.DxfMText.?(DrawContext ?, IPathDrawer ?) at WW.Cad.Model.Entities.DxfMText.DrawInternal(Wireframe context, IWireframeGraphicsFactory graphicsFactory) at WW.Cad.Model.Entities.DxfEntity.Draw(Wireframe context, IWireframeGraphicsFactory graphicsFactory) at WW.Cad.Drawing.BoundsCalculator.GetBounds(DxfModel model, Matrix4D modelTransform) at WW.Cad.Drawing.BoundsCalculator.GetBounds(DxfModel model) at WW.Cad.Model.DxfModel.?(Boolean ?) at WW.Cad.IO.DwgReader.Read(DxfModel model) at WW.Cad.IO.DwgReader.Read() at WW.Cad.IO.DwgReader.Read(String filename, ProgressEventHandler progressEventHandler)
I have attached the DWG that gives the error. CadLib version 4.0.38.141
Wout
3/1/2019 12:19 AM
Can you post the code that causes this problem? Including file path please. I can't reproduce the problem. - Wout
LYoung
3/1/2019 1:29 AM
There's not much to post, but here it is; The path is E:\Sandbox\DWGs\Draw1.DWG
C# Code:
public DxfModel ReadFile(string path) { Logger.LogDebug($"ReadFile path: {path}"); if (string.IsNullOrEmpty(path)) { throw new ArgumentNullException("path", "path cannot be null"); } if (!System.IO.File.Exists(path)) { #if DEBUG ShowDebugInfo(String.Format("Path does not exist: {0}", path)); #endif return null; } DxfModel.FallbackTrueTypeFonts = null; DxfModel.FallbackShxFont = null; DxfModel model = default(DxfModel); try { model = DwgReader.Read(path); } catch (Exception ex) { Logger.LogException("Error reading drawing.", ex); model = null; return null; } return model; }
I am unable to unit test this to reproduce the issue, however, it's occurring in my customers environments when called in my product. All of them indicate the same 'C:\magicvc' path. I also had this exception;
C# Code:
System.IO.PathTooLongException: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters. at System.IO.PathHelper.GetFullPathName() at System.IO.Path.LegacyNormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths) at System.IO.Path.GetFullPathInternal(String path) at System.IO.FileSystemEnumerableIterator`1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler`1 resultHandler, Boolean checkHost) at System.IO.Directory.GetFiles(String path, String searchPattern) at WW.IO.DirectoryUtil.?(String ?, String ?, Queue`1 ?)
Is there a property I can set or method I can call to bypass whatever is calling WW.Drawing.FontFromCurrentDirectoryFileLoader.Exists?
Wout
3/1/2019 2:09 PM
Ok, I've added an catch exception in the particular piece of code in version 4.0.38.152. Apparently it is some weird behavior in System.IO.Directory.GetFiles, even though the code before that checks that the directory exists. I think it has to do with directory aliases or network locations, can't really tell since I don't know the customer's environment. Thanks for the report, - Wout
LYoung
3/1/2019 4:13 PM
I updated to 4.0.38.141 and I am still receiving the same error.
C# Code:
System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\magicvc'.
That path does not exist on my machine. However, when using Search Everything from voidtools, the path shows up for some reason. It is not a hidden directory. I haven't updated my customer but their error is;
C# Code:
System.IO.PathTooLongException: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
On another machine, the ReadFile method hangs. Is there anything that can be done to bypass the method that calls Directory.GetFiles?
LYoung
3/1/2019 4:35 PM
Loading the file I sent you took 16 minutes on another machine, and it finally failed with;
C# Code:
System.NullReferenceException: Object reference not set to an instance of an object. at WW.Cad.Model.DxfModel.GetFallbackTrueTypeFontFilename(FontStyle fontStyle) at ?.?(String ?, Boolean ?, Boolean ?, FontFamily& ?, FontStyle& ?, ?& ?) at ?.?..ctor(String ?, Boolean ?, Boolean ?) at ?.?(String ?, Boolean ?, Boolean ?) at ?.get_?() at ?..ctor(? ?) at ?.?(String ?, Double ?, Double ?, AttachmentPoint ?, Double ?, LineSpacingStyle ?, DxfTextStyle ?, Double ?, Color ?, DrawingDirection ?, String& ?) at ?.?(String ?, Double ?, Double ?, AttachmentPoint ?, Double ?, LineSpacingStyle ?, DxfTextStyle ?, Double ?, Color ?, DrawingDirection ?, Int16 ?, Matrix4D ?, ? ?, ? ?) at ?.?(DxfModel ?, DxfMText ?, Color ?, Int16 ?, Matrix4D ?, Bounds2D ?) at WW.Cad.Model.Entities.DxfMText.?(DrawContext ?, IPathDrawer ?) at WW.Cad.Model.Entities.DxfMText.DrawInternal(Wireframe context, IWireframeGraphicsFactory graphicsFactory) at WW.Cad.Model.Entities.DxfEntity.Draw(Wireframe context, IWireframeGraphicsFactory graphicsFactory) at WW.Cad.Drawing.BoundsCalculator.GetBounds(DxfModel model, Matrix4D modelTransform) at WW.Cad.Drawing.BoundsCalculator.GetBounds(DxfModel model) at WW.Cad.Model.DxfModel.?(Boolean ?) at WW.Cad.IO.DwgReader.Read(DxfModel model) at WW.Cad.IO.DwgReader.Read() at WW.Cad.IO.DwgReader.Read(String filename, ProgressEventHandler progressEventHandler)
Wout
3/1/2019 5:34 PM
Hadn't spotted the additional exception, I've added a catch for that one too. I've also changed to not searching sub directories any more when searching fonts in the current directory. Was this a large directory tree where you had the long loading time? Maybe it was on a network too? Changes in version 4.0.38.154. - Wout
LYoung
3/1/2019 6:35 PM
Is .154 up? It wasn't large, no. It doesn't have any subdirectories.
Wout
3/1/2019 9:26 PM
Yes, it's online. The download is now in Your resources in your profile by the way. Odd, then I don't understand why it's slow. - Wout
LYoung
3/1/2019 9:39 PM
Edit: Saw your edit and I see the correct version. Thanks.
Annotation 2019-03-01 163825.jpg
1 2  next >