From c581a33462779de42111e1996faeb245d37b3580 Mon Sep 17 00:00:00 2001 From: Bastian Blokland Date: Tue, 26 Nov 2019 18:59:34 +0200 Subject: [PATCH] Disable tracelogger on net46 with mono backend Workaround for: https://github.com/BastianBlokland/componenttask-unity/issues/20 Disable the trace-logger on the '.Net 4.x' api in combination with the 'mono' scripting backend. Reason is that the code-stripper (on all settings except 'Disabled') removes part of 'System.Configuration' on which 'System.Diagnostics.TraceListener' depends. Because upm packages do not support 'link.xml' files at this time there is no easy way to instruct the stripper not to remove those. Disabling is acceptable in this case as its only used as a log-sink for 'Debug.Assert' and 'Debug.Fail' and either of those triggering would mean there is a serious bug in this repository. --- src/ComponentTask/Internal/TraceLogger.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/ComponentTask/Internal/TraceLogger.cs b/src/ComponentTask/Internal/TraceLogger.cs index 1495d56..27865b1 100644 --- a/src/ComponentTask/Internal/TraceLogger.cs +++ b/src/ComponentTask/Internal/TraceLogger.cs @@ -1,3 +1,13 @@ +/* Workaround for: https://github.com/BastianBlokland/componenttask-unity/issues/20 +Disable the trace-logger on the '.Net 4.x' api in combination with the 'mono' scripting backend. +Reason is that the code-stripper (on all settings except 'Disabled') removes part of +'System.Configuration' on which 'System.Diagnostics.TraceListener' depends. +Because upm packages do not support 'link.xml' files at this time there is no easy way to instruct +the stripper not to remove those. Disabling is acceptable in this case as its only used as a log-sink +for 'Debug.Assert' and 'Debug.Fail' and either of those triggering would mean there is a serious bug +in this repository. */ +#if !(ENABLE_MONO && NET_4_6) + using System.Diagnostics; namespace ComponentTask.Internal @@ -43,3 +53,5 @@ runs AFTER scene load and not before should give projects the chance to use thei } } } + +#endif // !(ENABLE_MONO && NET_4_6)