XbimEssentials icon indicating copy to clipboard operation
XbimEssentials copied to clipboard

IfcStore.Create() throws "The path is not in a valid format." exception

Open OndrejJanota91 opened this issue 9 months ago • 7 comments

Hi XBim team.

On one of the computers I am getting "The path is not in a valid format." exception during IFC generation. Code line which throws this exception is following:

using (var ifcStore = IfcStore.Create(filePath, IFCParts4x3.GetCredentials(), XbimSchemaVersion.Ifc4x3))

I have looked into the XBim library and it ends in the following constructor:

/// <summary> /// Constructor used to create a new persistent model with specified path /// </summary> /// <param name="filepath"></param> /// <param name="ifcVersion"></param> /// <param name="editorDetails"></param> protected IfcStore(string filepath, XbimSchemaVersion ifcVersion, XbimEditorCredentials editorDetails) : this() { var model = ModelProvider.Create(ifcVersion, filepath); AssignModel(model, editorDetails, ifcVersion); } Any idea how to solve/overcome this ussue?

Thanks for your work.

Best,

Ondřej

OndrejJanota91 avatar Apr 04 '25 06:04 OndrejJanota91

Are you using the Toolkit in environment other than Windows?

martin1cerny avatar Apr 04 '25 13:04 martin1cerny

@martin1cerny no, it is in windows environment.

OndrejJanota91 avatar Apr 07 '25 06:04 OndrejJanota91

What is the value of filePath?

andyward avatar Apr 07 '25 08:04 andyward

It is not fixed. It depends on the user and his/her input. Generally, it is valid folder somewhere on the PC (e.g. desktop or save folder, user folder or project folder). I have also tried this overload for IfcStore.Create but with same error:

using (var ifcStore = IfcStore.Create(IFCParts4x3.GetCredentials(), XbimSchemaVersion.Ifc4x3, XbimStoreType.InMemoryModel))

OndrejJanota91 avatar Apr 07 '25 10:04 OndrejJanota91

Can we see a stack trace / error message? This is really simple code so it's hard to see where it's going wrong. I've added a test case to demo this working. My guess is some kind of missing dependency/environmental issue.

Your best bet is to share a full reproduction we can take a look at - including the project file.

andyward avatar Apr 07 '25 11:04 andyward

That would be a problem. It happens at one of my customers machine. On the others it does work... So on my. If I put my code into a try except statement, it raises error message as mentioned above. Is there another possibility to gain more info?

OndrejJanota91 avatar Apr 07 '25 12:04 OndrejJanota91

Sorry there's really not a lot to go on if that's the case. Can you maybe get some logs from the customer machine - with stack traces? If you can log the exception it would be helpful.

Without that, the error message "The path is not in a valid format." is not one I recognise from xbim Toolkit or .net so I can't make any suggestions.

andyward avatar Apr 07 '25 21:04 andyward