xBimTeam / XbimWindowsUI

The home of XbimXplorer and WPF components for your desktop BIM applications.
Other
255 stars 150 forks source link

Getting AccessViolationException #59

Closed Jero9999 closed 7 years ago

Jero9999 commented 7 years ago

Just when I open a particular file. Note, the file itself has some errors in it but those errors have not stopped me before. Note 2 this is a file for debugging so it is probably pretty non standard.

The issue seems to be in the geometry engine itself but since I'm getting it in this application I'm raising it here.

sample.zip

Here is the stack trace

    [Managed to Native Transition]  
>   Xbim.Geometry.Engine32.dll!Xbim.Geometry.XbimSolidSet.Cut(Xbim.Common.Geometry.IXbimSolidSet solids, double tolerance)  Unknown
    Xbim.Geometry.Engine32.dll!Xbim.Geometry.XbimSolid.Cut(Xbim.Common.Geometry.IXbimSolidSet toCut, double tolerance)  Unknown
    Xbim.Geometry.Engine32.dll!Xbim.Geometry.XbimGeometryCreator.CreateBooleanResult(Xbim.Ifc4.Interfaces.IIfcBooleanResult clip)   Unknown
    Xbim.Geometry.Engine32.dll!Xbim.Geometry.XbimGeometryCreator.Create(Xbim.Ifc4.Interfaces.IIfcGeometricRepresentationItem geomRep, Xbim.Ifc4.Interfaces.IIfcAxis2Placement3D objectLocation) Unknown
    Xbim.Geometry.Engine.Interop.dll!Xbim.Geometry.Engine.Interop.XbimGeometryEngine.Create(Xbim.Ifc4.Interfaces.IIfcGeometricRepresentationItem ifcRepresentation, Xbim.Ifc4.Interfaces.IIfcAxis2Placement3D objectLocation)   Unknown
    Xbim.ModelGeometry.Scene.dll!Xbim.ModelGeometry.Scene.Xbim3DModelContext.WriteShapeGeometries.AnonymousMethod__1f(int shapeId)  Unknown
    mscorlib.dll!System.Threading.Tasks.Parallel.PartitionerForEachWorker.AnonymousMethod__1()  Unknown
    mscorlib.dll!System.Threading.Tasks.Task.InnerInvoke()  Unknown
    mscorlib.dll!System.Threading.Tasks.Task.InnerInvokeWithArg(System.Threading.Tasks.Task childTask)  Unknown
    mscorlib.dll!System.Threading.Tasks.Task.ExecuteSelfReplicating.AnonymousMethod__0(object value)    Unknown
    mscorlib.dll!System.Threading.Tasks.Task.InnerInvoke()  Unknown
    mscorlib.dll!System.Threading.Tasks.Task.Execute()  Unknown
    mscorlib.dll!System.Threading.Tasks.Task.ExecutionContextCallback(object obj)   Unknown
    mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)   Unknown
    mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)   Unknown
    mscorlib.dll!System.Threading.Tasks.Task.ExecuteWithThreadLocal(ref System.Threading.Tasks.Task currentTaskSlot)    Unknown
    mscorlib.dll!System.Threading.Tasks.Task.ExecuteEntry(bool bPreventDoubleExecution) Unknown
    mscorlib.dll!System.Threading.Tasks.Task.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem() Unknown
    mscorlib.dll!System.Threading.ThreadPoolWorkQueue.Dispatch()    Unknown
    mscorlib.dll!System.Threading._ThreadPoolWaitCallback.PerformWaitCallback() Unknown
theebow commented 7 years ago

it seems Xbim.Geometry.Engine32.dll is missing in your output application directory (x86) try to copy x86 and x64 directory (containing Xbim.Geometry.Engine32.dll and Xbim.Geometry.Engine64.dll)

Jero9999 commented 7 years ago

Thanks for the reply. I can confirm that the Output folder has both the x86 and x64 folders. They both have the 32 or 64 dll in them. Looking in NuGet package manager the XBim.Geometry package is there and is v4.0.11 I am using the latest code from the master branch.

Also, this is only one or two files that have this problem. If I didn't have those dlls then nothing at all would render for any files would it?

CBenghi commented 7 years ago

Hello @Jero9999, when notifying of bugs, please look at the develop branch instead of master, we have quite long release timeframes. However I'm hoping to release a master version soonish (weeks). I can look into the file if you wish, but it seems to open file for me, except for 7 caught errors and hundreds of warnings on non-closed polylines.

The file also has the following validation issues, is there a particular geometry of interest that is missing from the model?

Entity #7 (IfcOwnerHistory) has validation failures.
    IfcOwnerHistory.OwningApplication is not optional.
Entity #69 (IfcShapeRepresentation) has validation failures.
    IfcShapeRepresentation.Items must have at least 1 item(s). It has 0.
Entity #1413 (IfcBuildingElementProxy) has validation failures.
    Issue of type EntityWhereClauses on IfcBuildingElementProxy.WR1.
Entity #1419 (IfcShapeRepresentation) has validation failures.
    Issue of type EntityWhereClauses on IfcShapeModel.WR11.
Entity #2063 (IfcShapeRepresentation) has validation failures.
    Issue of type EntityWhereClauses on IfcShapeModel.WR11.
Entity #6014 (IfcAxis2Placement3D) has validation failures.
    Issue of type EntityWhereClauses on IfcAxis2Placement3D.WR4.
Entity #7411 (IfcBuildingElementProxy) has validation failures.
    Issue of type EntityWhereClauses on IfcBuildingElementProxy.WR1.
Entity #7417 (IfcShapeRepresentation) has validation failures.
    Issue of type EntityWhereClauses on IfcShapeModel.WR11.
Entity #8061 (IfcShapeRepresentation) has validation failures.
    Issue of type EntityWhereClauses on IfcShapeModel.WR11.
Entity #12012 (IfcAxis2Placement3D) has validation failures.
    Issue of type EntityWhereClauses on IfcAxis2Placement3D.WR4.
Entity #13409 (IfcBuildingElementProxy) has validation failures.
    Issue of type EntityWhereClauses on IfcBuildingElementProxy.WR1.
Entity #13415 (IfcShapeRepresentation) has validation failures.
    Issue of type EntityWhereClauses on IfcShapeModel.WR11.
Entity #14059 (IfcShapeRepresentation) has validation failures.
    Issue of type EntityWhereClauses on IfcShapeModel.WR11.
Entity #18010 (IfcAxis2Placement3D) has validation failures.
    Issue of type EntityWhereClauses on IfcAxis2Placement3D.WR4.
Entity #19407 (IfcBuildingElementProxy) has validation failures.
    Issue of type EntityWhereClauses on IfcBuildingElementProxy.WR1.
Entity #19413 (IfcShapeRepresentation) has validation failures.
    Issue of type EntityWhereClauses on IfcShapeModel.WR11.
Entity #20057 (IfcShapeRepresentation) has validation failures.
    Issue of type EntityWhereClauses on IfcShapeModel.WR11.
Entity #24008 (IfcAxis2Placement3D) has validation failures.
    Issue of type EntityWhereClauses on IfcAxis2Placement3D.WR4.
Entity #24483 (IfcBuildingElementProxy) has validation failures.
    Issue of type EntityWhereClauses on IfcBuildingElementProxy.WR1.
Entity #24489 (IfcShapeRepresentation) has validation failures.
    IfcShapeRepresentation.Items must have at least 1 item(s). It has 0.
    Issue of type EntityWhereClauses on IfcShapeModel.WR11.
Entity #24493 (IfcShapeRepresentation) has validation failures.
    Issue of type EntityWhereClauses on IfcShapeModel.WR11.
Entity #27804 (IfcAxis2Placement3D) has validation failures.
    Issue of type EntityWhereClauses on IfcAxis2Placement3D.WR4.
Entity #28279 (IfcBuildingElementProxy) has validation failures.
    Issue of type EntityWhereClauses on IfcBuildingElementProxy.WR1.
Entity #28285 (IfcShapeRepresentation) has validation failures.
    IfcShapeRepresentation.Items must have at least 1 item(s). It has 0.
    Issue of type EntityWhereClauses on IfcShapeModel.WR11.
Entity #28289 (IfcShapeRepresentation) has validation failures.
    Issue of type EntityWhereClauses on IfcShapeModel.WR11.
Entity #31600 (IfcAxis2Placement3D) has validation failures.
    Issue of type EntityWhereClauses on IfcAxis2Placement3D.WR4.
Entity #32075 (IfcBuildingElementProxy) has validation failures.
    Issue of type EntityWhereClauses on IfcBuildingElementProxy.WR1.
Entity #32081 (IfcShapeRepresentation) has validation failures.
    IfcShapeRepresentation.Items must have at least 1 item(s). It has 0.
    Issue of type EntityWhereClauses on IfcShapeModel.WR11.
Entity #32085 (IfcShapeRepresentation) has validation failures.
    Issue of type EntityWhereClauses on IfcShapeModel.WR11.
Entity #35341 (IfcShapeRepresentation) has validation failures.
    IfcShapeRepresentation.OfProductRepresentation must have no more than 1 item(s). It has at least 2.
    Issue of type EntityWhereClauses on IfcShapeModel.WR11.
Entity #35396 (IfcAxis2Placement3D) has validation failures.
    Issue of type EntityWhereClauses on IfcAxis2Placement3D.WR4.
Jero9999 commented 7 years ago

Hi @CBenghi Sorry for not replying sooner. I agree about the errors in the file itself. Fixing those is on my list - actually I hope I've already done it. My point I guess is that bad file data shouldn't crash the program :-)

I am trying to set up the develop branch environment but I could use some help. The WindowsUI solution references versions of Essentials and Geometry which aren't on the standard nuget repositories. Do you have those packages up on any other repo that I can get to? Or can you help me set it up locally? (I notice that when I get the develop branches of those packages, the version numbers are still not right for the ones I need)

Thanks Jero

CBenghi commented 7 years ago

Hello @Jero9999, if you read http://docs.xbim.net/index.html scroll down to "Compilation" section and you'll find the url for the Nuget repositories. Sure, anything that crashes the program should be addressed. I'm happy to help, as far as I know the file does not crash develop branch. Claudio

Jero9999 commented 7 years ago

Thanks @CBenghi I have seen that before but forgot it was there. Sorry about that. Turns out I already added those to my list of providers but I wasn't actually using it. However I still have a problem there. It looks like the latest develop branch of WindowsUI is referencing versions of Essentials and Geometry that have been removed from the xbim-develop nuget server. So NuGet doesn't actually know how to uninstall that version in order to upgrade to the newest version that is there. I would suggest leaving the old versions there in future to get around this problem.

In the meantime, could you update the develop branch so that it uses the latest essentials and geometry packages that are on xbim-develop?

Thanks Jero

CBenghi commented 7 years ago

@Jero9999, If you have the develop repository in your list they should be there. I just checked.

  <package id="Xbim.Essentials" version="4.0.28-V018" targetFramework="net45" />
  <package id="Xbim.Geometry" version="4.0.15-V0007" targetFramework="net45" />

Are both present in the repo.

Jero9999 commented 7 years ago

So I just checked and for some reason my checkout didn't get the latest version of the develop branch. Updating fixed it all.

I'll start using it and tell you if I can get any more crashes