We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Urgent : Illegal characters in path

I’ve an issue in only ONE of my 1000 customers.

System.ArgumentException: Caractères non conformes dans le chemin d'accès.
   à System.IO.Path.CheckInvalidPathChars(String path)
   à System.IO.Path.IsPathRooted(String path)
   à xf9a9481c3f63a419.xed747ca236d86aa0.x82611b255d9983ac(IDictionary xec232eb93dd022a7)
   à xc23bef7190ca8f55.x6412d0c71c34c05c.x99a36cf35453249e(String x4fd966aaf32161e8)
   à xc23bef7190ca8f55.x6412d0c71c34c05c.get_x99f0e2a5ac5ce2db()
   à xc23bef7190ca8f55.x6412d0c71c34c05c.xd3f8e541b341f67a()
   à xc23bef7190ca8f55.x6412d0c71c34c05c.x9059a3203c8fc855(String xa79a9f649c74f4a4, FontStyle x44ecfea61c937b8e, String x050683ee5a5f962b, Boolean x41c20a2d94f1f466)
   à xc23bef7190ca8f55.x6412d0c71c34c05c.x9059a3203c8fc855(String xa79a9f649c74f4a4, FontStyle x44ecfea61c937b8e, String x050683ee5a5f962b)
   à x59d6a4fc5007b7a4.xacc55eb1e4595209.xc06de25aa714683f(x1d1dd20018fcde10 x26094932cf7a9139, x000f21cbda739311 x6f02b6a80bf6b36f)
   à x59d6a4fc5007b7a4.x4f38812d0d5e7231.xbfac429e165a6a0d.xee5277c7de5be8e4(Char x3c4da2980d043c95)
   à x59d6a4fc5007b7a4.x4f38812d0d5e7231.xbfac429e165a6a0d.x47f176deff0d42e2()
   à x59d6a4fc5007b7a4.x4f38812d0d5e7231.x4fb8d507f4b3c96e(Font x0078185e1040c523, String xb41faee6912a2313, x000f21cbda739311 xcb075c7088c3b520)
   à xf989f31a236ff98c.x08802e9e984cd3ee.xc325f08e9c7ac384()
   à xf989f31a236ff98c.x08802e9e984cd3ee.xd22cb714335f8d2c(String xb41faee6912a2313, Font x26094932cf7a9139)
   à x59d6a4fc5007b7a4.x4f38812d0d5e7231..ctor(String text, x1d1dd20018fcde10 font, xacc55eb1e4595209 converter)
   à x59d6a4fc5007b7a4.x42f2a218ce59dafb.xbd6559e9bd341cd6(Inline xda5bf54deb817e37, Int32 x10aaa7cdfa38f254, Int32 x961016a387451f05)
   à x59d6a4fc5007b7a4.x487cdc969fefe3d6.x4e33137198fdb9ca(Boolean xcd31b50c43a96e21)
   à x59d6a4fc5007b7a4.x487cdc969fefe3d6.x47f176deff0d42e2()
   à x59d6a4fc5007b7a4.xcde671c53995c411.xd9db07500873ae98(Document x3664041d21d73fdc, xdeb77ea37ad74c56 xdfde339da46db651)
   à xf989f31a236ff98c.x6c74398bceb133f8.xa2e0b7f7da663553(x8556eed81191af11 x5ac1382edb7bf2c2)
   à Aspose.Words.Document.xf381a641001e6830(Stream xcf18e5243f8d5fd3, String xafe2f3653ee64ebc, SaveOptions xc27f01f21f67608c)
   à Aspose.Words.Document.Save(String fileName, SaveOptions saveOptions)
   à GenApi.Framework.Exports.Document.Manager.cExportManager.Export(ExportType pExportType)

The doc.Save method is called with arguments : aDoc.Save(filePath, SaveFormat.Pdf);
variable declaration is :

filePath = Path.ChangeExtension(Path.GetTempFileName(), ExportExtensions.PDF);
so no way there can be an error with backslashes escaping.
I’ve the same issue with running this code in asp.net or on a winform, so the target directory can be in %userprofile% or c:\windows\temp… no differences.
name of the file is : tmpC543.pdf… no special chars.

I’m pretty sure that this argument is not the main cause, and that the stack shown use another path.
I’ve double-check environment variable, and they look fine.
Additionaly, in the temp directory, I found the matching .tmp and .pdf files, proving that the pdf file is well created by Aspose (0byte), and the stack probably show another filewrite in another path.

I’m unable to reproduce the problem in lab, but the issue is constant in the customer (win 2k8 server, app using .NET4, aspose version It’s impossible for me to update Aspose.Words for this client without a full release of the product (impossible !).

Additionaly, I’ve a really hard deadline to deal with, with a government inspection in this customer next tuesday requiring this feature.

Can you give me more information about this path ? How is it build ? Can I change something on the client config to avoid the issue ?
Thanks !

Environment varibles :

CAB_HOME_R14=C:\Program Files (x86)\CA\SharedComponents\ARCserve Backup\Setup\r15<br>CommonProgramFiles=C:\Program Files\Common Files
CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
CommonProgramW6432=C:\Program Files\Common Files
CONNPATH=C:\Program Files (x86)\CA\ARCserve Backup<br>ExchangeInstallPath=E:\programmes\microsoft\exchange server\v14<br>FP_NO_HOST_CHECK=NO
Path=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\idmu\common;E:\programmes\microsoft\exchange server\v14\bin;C:\Program Files (x86)\ExchangeMapi;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn;C:\Program Files\Microsoft SQL Server\100\Tools\Binn;C:\Program Files\Microsoft SQL Server\100\DTS\Binn;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE;C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn<br>[PATHEXT=.COM](http://PATHEXT=.COM);.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 44 Stepping 2, GenuineIntel
ProgramFiles=C:\Program Files
ProgramFiles(x86)=C:\Program Files (x86)
ProgramW6432=C:\Program Files

Hi Delarue,

Thanks for your inquiry. I have tested the same scenario and have not found any exception while using latest version of Aspose.Words for .NET. Please use the latest version of Aspose.Words for .NET. If you still face problem, please attach your input Word document here for testing? I will investigate the issue on my side and provide you more information.

Hi Tahir,

It’s impossible to release a “patch” of our soft with updated Aspose.Words in one week. I’ve too much components using this library, and the library has a lot of changes.

The word document is fully generated by code. The only one picture come from embedded resources. There is no input file.
As I’ve said, I can’t reproduce the issue in lab, in or in latest version. The problem only occurs in one of thousands customers.

Can you deobfuscate the stack, and give me how the problematic file path is created in ?

As a workaround, I’ve downloaded the customer’s database, print the document in lab and send it to the customer. But that can’t be a long term solution. Our next software release using updated Aspose libraries, will not be ready before january.

Hi Delarue,

Thanks for sharing the details. Unfortunately, we do not provide patches or hot fixes for old version of Aspose products. The only way to get a fix is upgrading to the newest versions. Please note that every new release of Aspose.Words comes up with some new features, enhancements in the existing features and bug fixes.

It seems that path generated at your customer’s end is not correct. Try to use @ before the string like :

Document.Save(@"c:\tempfiles\test.pdf", SaveFormat.Pdf);

I suggest you to read following documentation article for your kind reference.

Have you tested this scenario with same environment (Operating System, .NET framework version) as your customer have?

It look like you have not read my previous message, or my english is too much approximate (sorry).

In the first one, I describe how the path is build, proving that string escaping can’t be wrong at the variable passed to the public function. I’ve added that the file IS created by aspose (but not filled), proving that the provided path is correct.

I totally understand that you will not provide a fix on this version. And that’s not what I’m asking.
I want you to go in your source code for version 9600, at the line where the stack is crashing, and show me WHAT is tried to be writed and HOW IS BUILD the path who crashed.

=> So I can try to find a workaround myself.

Hi Delarue,

Please accept my apologies for your inconvenience.


I’m unable to reproduce the problem in lab, but the issue is constant in the customer (win 2k8 server, app using .NET4, aspose version It’s impossible for me to update Aspose.Words for this client without a full release of the product (impossible !).

Did you test this scenario over same working environment (Operating System and .NET framework) as your customer have?

Could you please share your code which generate PDF file for testing? I will investigate the issue on my side and provide you more information.

string filePath = Path.ChangeExtension(Path.GetTempFileName(), ".PDF");
Document doc = new Document();
doc.Save(filePath, SaveFormat.Pdf);