freezy / VisualPinball.Engine

:video_game: Visual Pinball Engine for Unity
https://docs.visualpinball.org
GNU General Public License v3.0
417 stars 62 forks source link

NLog crash on Android #277

Closed jsm174 closed 3 years ago

jsm174 commented 3 years ago

To get familiar with VR development, I attempted to run Visual Pinball Engine on an Oculus Quest 2.

With a fresh project in Unity, I installed Oculus XR Plugin via the Package Manager. This automatically enables XR Plugin. (Doing this in reverse, would always crash Unity in 2020.2.1f1 on an M1 Mac Mini). I then added Visual Pinball Engine, and enabled NetVips and NetMiniZ dlls to be included in Android. (This was just to allow for compiling, since they currently don't get used at runtime)

When starting Visual Pinball Engine on the Oculus it crashes immediately after the Unity splash screen.

The stack trace is:

01-04 08:28:53.788 23347 23407 E CRASH   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
01-04 08:28:53.788 23347 23407 E CRASH   : Version '2020.2.1f1 (270dd8c3da1c)', Build type 'Development', Scripting Backend 'mono', CPU 'armeabi-v7a'
01-04 08:28:53.788 23347 23407 E CRASH   : Build fingerprint: 'oculus/hollywood/hollywood:10/QP1A.190711.020/12018400103000000:user/release-keys'
01-04 08:28:53.788 23347 23407 E CRASH   : Revision: '0'
01-04 08:28:53.788 23347 23407 E CRASH   : ABI: 'arm'
01-04 08:28:53.788 23347 23407 E CRASH   : Timestamp: 2021-01-04 08:28:53-0500
01-04 08:28:53.788 23347 23407 E CRASH   : pid: 23347, tid: 23407, name: Loading.Preload  >>> com.DefaultCompany.o4 <<<
01-04 08:28:53.788 23347 23407 E CRASH   : uid: 10005
01-04 08:28:53.788 23347 23407 E CRASH   : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x464
01-04 08:28:53.788 23347 23407 E CRASH   : Cause: null pointer dereference
01-04 08:28:53.788 23347 23407 E CRASH   :     r0  adf55588  r1  0000004c  r2  0000004c  r3  00000000
01-04 08:28:53.788 23347 23407 E CRASH   :     r4  0000004c  r5  a00ca140  r6  00005654  r7  e8f30c1c
01-04 08:28:53.788 23347 23407 E CRASH   :     r8  ae904d50  r9  00000000  r10 00000000  r11 adf55588
01-04 08:28:53.788 23347 23407 E CRASH   :     ip  e6fe050c  sp  adf55570  lr  bfe5fefd  pc  bf240c5e
01-04 08:28:53.788 23347 23407 E CRASH   :
01-04 08:28:53.788 23347 23407 E CRASH   : backtrace:
01-04 08:28:53.788 23347 23407 E CRASH   :       #00 pc 003a2c5e  /data/app/com.DefaultCompany.o4-pVUaVGK1-3TuEFneCEaTNQ==/lib/arm/libunity.so (FileAccessor::Position() const+2) (BuildId: 405fe9c42be9eaed5b244b0f1ec52277fe393253)
01-04 08:28:53.788 23347 23407 E CRASH   :
01-04 08:28:53.788 23347 23407 E CRASH   : managed backtrace:
01-04 08:28:53.788 23347 23407 E CRASH   :       #00 (wrapper managed-to-native) System.Diagnostics.Process:GetModules_internal (System.Diagnostics.Process,intptr)
01-04 08:28:53.788 23347 23407 E CRASH   :       #01 System.Diagnostics.Process:GetModules_internal (Microsoft.Win32.SafeHandles.SafeProcessHandle) <0x4f>
01-04 08:28:53.788 23347 23407 E CRASH   :       #02 System.Diagnostics.Process:get_Modules () <0x53>
01-04 08:28:53.788 23347 23407 E CRASH   :       #03 System.Diagnostics.Process:get_MainModule () <0x43>
01-04 08:28:53.788 23347 23407 E CRASH   :       #04 NLog.Internal.PortableProcessIDHelper:.ctor () <0x7f>
01-04 08:28:53.788 23347 23407 E CRASH   :       #05 NLog.Internal.ProcessIDHelper:Create () <0x1b>
01-04 08:28:53.788 23347 23407 E CRASH   :       #06 NLog.Internal.ProcessIDHelper:get_Instance () <0x27>
01-04 08:28:53.788 23347 23407 E CRASH   :       #07 NLog.Internal.Fakeables.AppEnvironmentWrapper:get_CurrentProcessFilePath () <0xf>
01-04 08:28:53.788 23347 23407 E CRASH   :       #08 NLog.Config.LoggingConfigurationFileLoader/<GetAppSpecificNLogLocations>d__14:MoveNext () <0x16b>
01-04 08:28:53.788 23347 23407 E CRASH   :       #09 NLog.Config.LoggingConfigurationFileLoader/<GetDefaultCandidateConfigFilePaths>d__13:MoveNext () <0x643>
01-04 08:28:53.788 23347 23407 E CRASH   :       #10 NLog.Config.LoggingConfigurationFileLoader:TryLoadFromFilePaths (NLog.LogFactory) <0xcf>
01-04 08:28:53.788 23347 23407 E CRASH   :       #11 NLog.Config.LoggingConfigurationFileLoader:Load (NLog.LogFactory) <0x1b>
01-04 08:28:53.789 23347 23407 E CRASH   :       #12 NLog.Config.LoggingConfigurationWatchableFileLoader:Load (NLog.LogFactory) <0x1b>
01-04 08:28:53.789 23347 23407 E CRASH   :       #13 NLog.LogFactory:get_Configuration () <0xe3>
01-04 08:28:53.789 23347 23407 E CRASH   :       #14 NLog.LogFactory:GetLoggerThreadSafe (string,System.Type) <0x1e7>
01-04 08:28:53.789 23347 23407 E CRASH   :       #15 NLog.LogFactory:GetLogger (string) <0x23>
01-04 08:28:53.789 23347 23407 E CRASH   :       #16 NLog.LogManager:GetCurrentClassLogger () <0x2f>
01-04 08:28:53.789 23347 23407 E CRASH   :       #17 VisualPinball.Unity.TableAuthoring:.cctor () </Users/jmillard/git/vpe/VisualPinball.Engine/VisualPinball.Unity/VisualPinball.Unity/VPT/Table/TableAuthoring.cs:86>
01-04 08:28:53.789 23347 23407 E CRASH   :       #18 (wrapper runtime-invoke) object:runtime_invoke_void (object,intptr,intptr,intptr)

Currently Visual Pinball Engine is using the NLog 4.7.6, Netstandard 2.0 DLL.

I started going through different versions of NLog, and the last working version is NLog 4.6.2.

Looking at the NLog 4.6.3 changelog, there is an improvement:

#3261 NLog config file loading: use process name (e.g. applicationname.exe.nlog) when app.config is not available (@snakefoot)

FWIW, considering the stack trace, https://github.com/NLog/NLog/pull/3261 does seem like it could be related.

freezy commented 3 years ago

This was solved, right? @jsm174 can you close if that's the case?

jsm174 commented 3 years ago

Correct, however, they haven't merged the fix into NLog yet - https://github.com/NLog/NLog/pull/4229.

Do we want to keep open until a new version of NLog is released?

freezy commented 3 years ago

Ah, okay.

I'd prefer keeping it open until it's merged and solved then. Thanks!

snakefoot commented 3 years ago

https://www.nuget.org/packages/NLog/4.7.7 has been released

jsm174 commented 3 years ago

Fixed in https://github.com/freezy/VisualPinball.Engine/pull/284