XbimGeometry icon indicating copy to clipboard operation
XbimGeometry copied to clipboard

AccessViolationException exception thrown when converting file

Open dcorrea777 opened this issue 3 years ago • 16 comments

The exception System.AccessViolationException is thrown when trying to convert an ifc file to wexbim

Assemblies and versions affected:

<PackageReference Include="Xbim.Geometry" Version="5.1.403" NoWarn="NU1701" />
<PackageReference Include="Xbim.Geometry.Engine.Interop" Version="5.1.403" NoWarn="NU1701" />
<PackageReference Include="Xbim.IO.Esent" Version="5.1.323" />
<PackageReference Include="Xbim.ModelGeometry.Scene" Version="5.1.403" NoWarn="NU1701" />
SDK do .NET (refletindo qualquer global.json):
 Version:   5.0.202
 Commit:    db7cc87d51

Ambiente de runtime:
 OS Name:     Windows
 OS Version:  10.0.19042
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\5.0.202\

Host (useful for support):
  Version: 5.0.5
  Commit:  2f740adc14

.NET SDKs installed:
  5.0.200 [C:\Program Files\dotnet\sdk]
  5.0.202 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.All 2.1.27 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.27 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.27 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download

Steps (or code) to reproduce the issue:

  XbimLogging.LoggerFactory.AddSerilog();
  IfcStore.ModelProviderFactory.UseHeuristicModelProvider();
  var file = "RSPA0004-ARQ-EX-URBF-RIF-TORRE_01-R02.ifc.zip"
  using (var ifc = IfcStore.Open(file))
  {
      var context = new Xbim3DModelContext(ifc);
      context.MaxThreads = 2;
      context.CreateContext();

      wexBimFilename = Path.ChangeExtension(file, "wexBIM");
      using (var wexBiMfile = File.Create(wexBimFilename))
      using (var wexBimBinaryWriter = new BinaryWriter(wexBiMfile))
      {
          ifc.SaveAsWexBim(wexBimBinaryWriter);
      }
  }

Minimal file to reproduce the issue:

I cannot make the file publicly available, if someone can pass the email I do it on OneDrive

Expected behavior:

I hope the file will be converted

Actual behavior or exception details:

Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Repeat 2 times:
--------------------------------
   at <Module>.BRepMesh_IncrementalMesh.{ctor}(BRepMesh_IncrementalMesh*, TopoDS_Shape*, Double, Boolean, Double, Boolean)
--------------------------------
   at Xbim.Geometry.XbimOccShape.WriteTriangulation(System.IO.BinaryWriter, Double, Double, Double)
   at Xbim.Geometry.XbimGeometryCreator.CreateShapeGeometry(Xbim.Common.Geometry.IXbimGeometryObject, Double, Double, Double, Xbim.Common.Geometry.XbimGeometryType, Microsoft.Extensions.Logging.ILogger)       
   at Xbim.Geometry.Engine.Interop.XbimGeometryEngine.CreateShapeGeometry(Xbim.Common.Geometry.IXbimGeometryObject, Double, Double, Double, Xbim.Common.Geometry.XbimGeometryType, Microsoft.Extensions.Logging.ILogger)
   at Xbim.ModelGeometry.Scene.Xbim3DModelContext+<>c__DisplayClass39_0.<WriteShapeGeometries>b__0(Int32)
   at System.Threading.Tasks.Parallel+<>c__DisplayClass44_0`2[[System.Int32, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, 
Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].<PartitionerForEachWorker>b__1(System.Collections.IEnumerator ByRef, Int32, Boolean ByRef)
   at System.Threading.Tasks.TaskReplicator+Replica`1[[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ExecuteAction(Boolean ByRef)
   at System.Threading.Tasks.TaskReplicator+Replica.Execute()
   at System.Threading.Tasks.TaskReplicator+Replica+<>c.<.ctor>b__4_0(System.Object)
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef, System.Threading.Thread)
   at System.Threading.Tasks.ThreadPoolTaskScheduler.TryExecuteTaskInline(System.Threading.Tasks.Task, Boolean)
   at System.Threading.Tasks.TaskScheduler.TryRunInline(System.Threading.Tasks.Task, Boolean)
   at System.Threading.Tasks.Task.InternalRunSynchronously(System.Threading.Tasks.TaskScheduler, Boolean)
   at System.Threading.Tasks.Task.RunSynchronously(System.Threading.Tasks.TaskScheduler)
   at System.Threading.Tasks.TaskReplicator.Run[[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](ReplicatableUserAction`1<System.__Canon>, System.Threading.Tasks.ParallelOptions, Boolean)
   at System.Threading.Tasks.Parallel.PartitionerForEachWorker[[System.Int32, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Concurrent.Partitioner`1<Int32>, System.Threading.Tasks.ParallelOptions, System.Action`1<Int32>, System.Action`2<Int32,System.Threading.Tasks.ParallelLoopState>, System.Action`3<Int32,System.Threading.Tasks.ParallelLoopState,Int64>, System.Func`4<Int32,System.Threading.Tasks.ParallelLoopState,System.__Canon,System.__Canon>, System.Func`5<Int32,System.Threading.Tasks.ParallelLoopState,Int64,System.__Canon,System.__Canon>, System.Func`1<System.__Canon>, System.Action`1<System.__Canon>)
   at System.Threading.Tasks.Parallel.ForEachWorker[[System.Int32, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<Int32>, System.Threading.Tasks.ParallelOptions, System.Action`1<Int32>, System.Action`2<Int32,System.Threading.Tasks.ParallelLoopState>, System.Action`3<Int32,System.Threading.Tasks.ParallelLoopState,Int64>, System.Func`4<Int32,System.Threading.Tasks.ParallelLoopState,System.__Canon,System.__Canon>, System.Func`5<Int32,System.Threading.Tasks.ParallelLoopState,Int64,System.__Canon,System.__Canon>, System.Func`1<System.__Canon>, System.Action`1<System.__Canon>)
   at System.Threading.Tasks.Parallel.ForEach[[System.Int32, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<Int32>, System.Threading.Tasks.ParallelOptions, System.Action`1<Int32>)
   at Xbim.ModelGeometry.Scene.Xbim3DModelContext.WriteShapeGeometries(XbimCreateContextHelper, Xbim.Common.ReportProgressDelegate, Xbim.Common.Geometry.IGeometryStoreInitialiser, Xbim.Common.Geometry.XbimGeometryType)
   at Xbim.ModelGeometry.Scene.Xbim3DModelContext.CreateContext(Xbim.Common.ReportProgressDelegate, Boolean)
   at Ifc.Converter.Converter.ToWexBim(System.String)
   at Ifc.Worker.Worker+<ExecuteAsync>d__5.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ExecutionContextCallback(System.Object)
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext(System.Threading.Thread)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext()
   at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Runtime.CompilerServices.IAsyncStateMachineBox, Boolean)
   at System.Threading.Tasks.Task.RunContinuations(System.Object)
   at System.Threading.Tasks.Task`1[[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].TrySetResult(System.__Canon)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].SetExistingTaskResult(System.Threading.Tasks.Task`1<System.__Canon>, System.__Canon)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].SetResult(System.__Canon)
   at Ifc.Converter.Storage+<Download>d__11.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ExecutionContextCallback(System.Object)
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext(System.Threading.Thread)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext()
   at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Runtime.CompilerServices.IAsyncStateMachineBox, Boolean)
   at System.Threading.Tasks.Task.RunContinuations(System.Object)
   at System.Threading.Tasks.Task`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].TrySetResult(System.Threading.Tasks.VoidTaskResult)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].SetExistingTaskResult(System.Threading.Tasks.Task`1<System.Threading.Tasks.VoidTaskResult>, System.Threading.Tasks.VoidTaskResult)
   at Amazon.S3.Transfer.Internal.DownloadCommand+<ExecuteAsync>d__11.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[Amazon.S3.Transfer.Internal.DownloadCommand+<ExecuteAsync>d__11, AWSSDK.S3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].ExecutionContextCallback(System.Object)
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[Amazon.S3.Transfer.Internal.DownloadCommand+<ExecuteAsync>d__11, AWSSDK.S3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext(System.Threading.Thread)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[Amazon.S3.Transfer.Internal.DownloadCommand+<ExecuteAsync>d__11, AWSSDK.S3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext()
   at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Runtime.CompilerServices.IAsyncStateMachineBox, Boolean)
   at System.Threading.Tasks.Task.RunContinuations(System.Object)
   at System.Threading.Tasks.Task`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].TrySetResult(System.Threading.Tasks.VoidTaskResult)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].SetExistingTaskResult(System.Threading.Tasks.Task`1<System.Threading.Tasks.VoidTaskResult>, System.Threading.Tasks.VoidTaskResult)
   at Amazon.S3.Model.GetObjectResponse+<WriteResponseStreamToFileAsync>d__140.MoveNext()
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[Amazon.S3.Model.GetObjectResponse+<WriteResponseStreamToFileAsync>d__140, AWSSDK.S3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604]].MoveNext(System.Threading.Thread)
   at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Runtime.CompilerServices.IAsyncStateMachineBox, Boolean)
   at System.Threading.Tasks.Task.RunContinuations(System.Object)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef, System.Threading.Thread)
   at System.Threading.ThreadPoolWorkQueue.Dispatch()

This is the convention log when I enable the XbimLogging.LoggerFactory.AddSerilog() method

log.txt

dcorrea777 avatar May 13 '21 12:05 dcorrea777

Hi @danilocorrea87, can you send a link to [email protected]?

CBenghi avatar May 14 '21 13:05 CBenghi

Hi @CBenghi I shared the file, can you confirm me?

The link expires on the 21st of this month.

dcorrea777 avatar May 14 '21 14:05 dcorrea777

Confirmed. There is indeed an opencascade violation. I'll have a look.

CBenghi avatar May 14 '21 14:05 CBenghi

Just for the record... this has failing geometries in several viewers, including Solibri and BimVision. I will still attempt to remove crashing errors, but I would recommend you to attempt another export from the original software once the product families have been adjusted.

CBenghi avatar May 14 '21 17:05 CBenghi

Thanks for the reply @CBenghi

Just to put it in context, we have a solution as a service where our customers send files to our system, and we convert it to be viewed on the web.

Just so I understand, this problem is related to how the user exports the ifc file from the software he uses, right?

dcorrea777 avatar May 15 '21 14:05 dcorrea777

That seems to be the problem, yes. We still should be able to prevent crashes, of course, which does not happen in this case. But the file is particularly bad.

On Sat, 15 May 2021 at 16:26, Danilo Correa @.***> wrote:

Thanks for the reply @CBenghi https://github.com/CBenghi

Just to put it in context, we have a solution as a service where our customers send files to our system, and we convert it to be viewed on the web.

Just so I understand, this problem is related to how the user exports the ifc file from the software he uses, right?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/xBimTeam/XbimGeometry/issues/339#issuecomment-841667012, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJY7MLQVYQBP22C3SKWVODTN2ACFANCNFSM442OQCYQ .

CBenghi avatar May 15 '21 14:05 CBenghi

@CBenghi can you help me with a question?

I wanted to work around this error below.

Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Repeat 2 times:

I tried microsoft's own documentation, but I didn't have any success.

https://docs.microsoft.com/en-us/dotnet/api/system.accessviolationexception?view=net-5.0

Is there any way I can catch this error and end my process manually?

dcorrea777 avatar May 17 '21 14:05 dcorrea777

You should be able to do something using https://docs.microsoft.com/en-us/dotnet/api/system.runtime.exceptionservices.handleprocesscorruptedstateexceptionsattribute?view=net-5.0

I've sometimes done it, which might be useful to exit gracefully, but still not a complete solution.

CBenghi avatar May 17 '21 17:05 CBenghi

@CBenghi I made sample code using [HandleProcessCorruptedStateExceptions] and I can't seem to catch this error.

Example:

using System.Threading.Tasks;
using System;
using System.IO;
using System.Runtime.ExceptionServices;
using System.Security;
using Xbim.Ifc;
using Xbim.IO;
using Xbim.ModelGeometry.Scene;

namespace XbimConverterTest
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Starting script...");
            try
            {
                ToConvert();
            }
            catch (System.Exception e)
            {   
                Console.WriteLine("An unexpected error has occurred");
                Console.WriteLine(e.Message);
            }
        }
        
        [SecurityCritical]
        [HandleProcessCorruptedStateExceptions]
        static void ToConvert()
        {
            const string fileName = @"RSPA0004-ARQ-EX-URBF-RIF-TORRE_01-R02.ifc.zip";
            var wexBimFilename = Path.ChangeExtension(fileName, "wexBIM");
            var xbimDbFilename = Path.ChangeExtension(fileName, "xBIM");

            // Make sure we are using an IModel implementation that supports saving of '.xbim' files
            IfcStore.ModelProviderFactory.UseHeuristicModelProvider();

            using (var model = IfcStore.Open(fileName))
            {
                // IFC file is already parsed and open. Now build the 3D
                var context = new Xbim3DModelContext(model);
                context.CreateContext();    // Creates the Geometry using native GeometryEngine

                // Optional: Export to 'wexbim' format for use in WebUI's xViewer - geometry only
                using (var wexBimFile = File.Create(wexBimFilename))
                {
                    using (var wexBimBinaryWriter = new BinaryWriter(wexBimFile))
                    {
                        model.SaveAsWexBim(wexBimBinaryWriter);
                        wexBimBinaryWriter.Close();
                    }
                    wexBimFile.Close();
                }

                // Save IFC to the internal XBIM format, which includes geometry
                model.SaveAs(xbimDbFilename, StorageType.Xbim);
            }            
        }
    }
}

output

Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Repeat 2 times:
--------------------------------
   at <Module>.BRepFill_Filling.Build(BRepFill_Filling*)
--------------------------------
   at Xbim.Geometry.XbimCompound.InitAdvancedFaces(TopoDS_Shape*, System.Collections.Generic.IEnumerable`1<Xbim.Ifc4.Interfaces.IIfcFace>, Microsoft.Extensions.Logging.ILogger)
   at Xbim.Geometry.XbimCompound.Init(Xbim.Ifc4.Interfaces.IIfcAdvancedBrep, Microsoft.Extensions.Logging.ILogger)
   at Xbim.Geometry.XbimCompound.Init(Xbim.Ifc4.Interfaces.IIfcManifoldSolidBrep, Microsoft.Extensions.Logging.ILogger)
   at Xbim.Geometry.XbimCompound..ctor(Xbim.Ifc4.Interfaces.IIfcManifoldSolidBrep, Microsoft.Extensions.Logging.ILogger)
   at Xbim.Geometry.XbimGeometryCreator.Create(Xbim.Ifc4.Interfaces.IIfcGeometricRepresentationItem, Xbim.Ifc4.Interfaces.IIfcAxis2Placement3D, Microsoft.Extensions.Logging.ILogger)
   at Xbim.Geometry.Engine.Interop.XbimGeometryEngine.Create(Xbim.Ifc4.Interfaces.IIfcGeometricRepresentationItem, Microsoft.Extensions.Logging.ILogger)
   at Xbim.ModelGeometry.Scene.Xbim3DModelContext+<>c__DisplayClass39_0.<WriteShapeGeometries>b__0(Int32)
   at System.Threading.Tasks.Parallel+<>c__DisplayClass44_0`2[[System.Int32, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].<PartitionerForEachWorker>b__1(System.Collections.IEnumerator ByRef, Int32, Boolean ByRef)
   at System.Threading.Tasks.TaskReplicator+Replica.Execute()
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(System.Threading.Thread, System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef, System.Threading.Thread)
   at System.Threading.ThreadPoolWorkQueue.Dispatch()

dcorrea777 avatar May 17 '21 17:05 dcorrea777

Add [HandleProcessCorruptedStateExceptions] in source code does not work for me too. But add this in yourApp.config,

 <legacyCorruptedStateExceptionsPolicy enabled="true"/>

between </ runtime>

It works.

crazyrainman avatar Jun 13 '21 00:06 crazyrainman

Hi @crazyrainman my project is using .net core 5 and uses the "worker" template, I don't think it has this configuration file you said. app.config

dcorrea777 avatar Jun 13 '21 01:06 dcorrea777

Is there something similar to ap.config? like app setting ?

crazyrainman avatar Jun 13 '21 06:06 crazyrainman

Also on my test, if merge changes on exceptions handling from develop branch made by Claudio Benghi , this exception should not occur.

crazyrainman avatar Jun 13 '21 06:06 crazyrainman

@crazyrainman From research, the configuration files for a .net core project is appsettings.json

https://forums.asp.net/t/2143633.aspx?Using+app+config+vs+appsettings+json

Is there something similar to ap.config? like app setting ?

dcorrea777 avatar Jun 13 '21 11:06 dcorrea777

Hi @crazyrainman my project is using .net core 5 and uses the "worker" template, I don't think it has this configuration file you said. app.config

Sorry for hijacking the issue, but is there already a preview version of xBim.Geometry for .NET Core available that runs on .NET Core 3.1 or .NET 5? I totally missed that😀

GeorgDangl avatar Jun 13 '21 13:06 GeorgDangl

@GeorgDangl The project I'm working on is using .net core 5, but it only works on windows.

Sorry for hijacking the issue, but is there already a preview version of xBim.Geometry for .NET Core available that runs on .NET Core 3.1 or .NET 5? I totally missed thatgrinning

dcorrea777 avatar Jun 13 '21 13:06 dcorrea777