From 4b3e29f0350dd6a29565e99835ad78a30c3605b8 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Thu, 18 Aug 2022 17:33:40 +0200 Subject: [PATCH 1/2] throwing new nullreference instead of 'null' --- .../Assets/Scripts/BugFarmButtons.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/samples/unity-of-bugs/Assets/Scripts/BugFarmButtons.cs b/samples/unity-of-bugs/Assets/Scripts/BugFarmButtons.cs index 213d87d68..f38cb64de 100644 --- a/samples/unity-of-bugs/Assets/Scripts/BugFarmButtons.cs +++ b/samples/unity-of-bugs/Assets/Scripts/BugFarmButtons.cs @@ -6,16 +6,30 @@ public class BugFarmButtons : MonoBehaviour { + private DateTime _now; + private void Start() { Debug.Log("Sample Start 🦋"); Debug.LogWarning("Here come the bugs 🐞🦋🐛🐜🕷!"); } + private void Update() + { + if (Input.GetKeyDown(KeyCode.Space)) + { + var start = DateTime.Now; + while ((DateTime.Now - start).Seconds < 6) + { + + } + } + } + public void AssertFalse() => Assert.AreEqual(true, false); [MethodImpl(MethodImplOptions.NoInlining)] - public void ThrowNull() => throw null; + public void ThrowNull() => throw new NullReferenceException(); public void ThrowExceptionAndCatch() { From 68c28ffa435f2993621b5702bde14236a2964d6b Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Thu, 18 Aug 2022 17:34:46 +0200 Subject: [PATCH 2/2] removed debug --- .../unity-of-bugs/Assets/Scripts/BugFarmButtons.cs | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/samples/unity-of-bugs/Assets/Scripts/BugFarmButtons.cs b/samples/unity-of-bugs/Assets/Scripts/BugFarmButtons.cs index f38cb64de..8ed690b65 100644 --- a/samples/unity-of-bugs/Assets/Scripts/BugFarmButtons.cs +++ b/samples/unity-of-bugs/Assets/Scripts/BugFarmButtons.cs @@ -6,26 +6,12 @@ public class BugFarmButtons : MonoBehaviour { - private DateTime _now; - private void Start() { Debug.Log("Sample Start 🦋"); Debug.LogWarning("Here come the bugs 🐞🦋🐛🐜🕷!"); } - private void Update() - { - if (Input.GetKeyDown(KeyCode.Space)) - { - var start = DateTime.Now; - while ((DateTime.Now - start).Seconds < 6) - { - - } - } - } - public void AssertFalse() => Assert.AreEqual(true, false); [MethodImpl(MethodImplOptions.NoInlining)]