xBimTeam / XbimGeometry

XbimGeometry contains the CLR interop libraries and the c++ engine used to compute the 3D geometry of models.
https://xbimteam.github.io/
Other
260 stars 131 forks source link

The Exit code of application is non zero when used latest myGet feed on develop. #438

Open CCT-Mukund-Thakare opened 1 year ago

CCT-Mukund-Thakare commented 1 year ago

Hello Team, The exit code of a c# console application is non zero (-1073610751) when I use the latest MyGet on develop branch for xBIM Geometry. There is no exception or error in the application. I do get the expected output from my application so ideally the exit code should be 0 but it is not.

Assemblies and versions affected:

Adding screen shot of the version's that I have installed using MyGet feed. image

Steps (or code) to reproduce the issue:

How do we check the error/exit code ? Adding screen shot showcasing to check the exit code of application. image

Minimal file to reproduce the issue:

I think it will get reproduced for any IFC file.

Expected behavior:

Exit code of application should be 0, when using latest MyGet feed.

Actual behavior or exception details:

It is not 0, it is -1073610751.

Additional Details

On previous version of xbim.geometry package, or any version that is installed using nugget.org, we are able to get exit code as 0. I have discussed this issue on this PR. Please have a look.

Thank you !!

andyward commented 1 year ago

I know you said you can't share the code but you'll have to provide some kind of minimal repo. The exit code on an app is usually just what you return from main().

-1073610751 = 0xC0020001 , which is the error code for an Unhandled Exception. Do you have any top level error handling code to trap and log the exception? The develop code is in wide use, so it's likely an environmental issue.

CCT-Mukund-Thakare commented 1 year ago

@andyward @SteveLockley

Hello Andy, Thank you for your reply.

I have prepared minimal repository to reproduce this issue. I have added steps to reproduce the issue.

Just to highlight the issue of exit code being non zero is still there in this minimal repo.

Thank you !!

andyward commented 1 year ago

Confirmed this is a bug in v5.1 Geometry Engine.

Clearly something in the application is being disposed/etc during application termination after main has returned. Global Exception Handlers don't pick this up.

It's the call into Xbim3DModelContext.CreateContext() that is the trigger so clearly something in the managed transition.

My guess is it's related to something related to Mixed mode resources. Sounds a bit similar to https://stackoverflow.com/questions/18098331/program-has-exited-with-code-1073610751-0xc0020001

Tested in v6 GE and we don't have the issue. Main returns zero. Since getting V6 released is our focus I don't know if we'll have time to investigate more deeply any time soon. Feel free to do more investigation and see if you can determine an error or exception that will help track down.

mukundthakare commented 9 months ago

Hello @andyward I was able to fix this bug in my application with a workaround. I have added this line, <loadFromRemoteSources enabled="true"/> in the app.config of my visual studio solution.

Thank you for your support.