61 Commits

Author SHA1 Message Date
Dan Balasescu
44127c571c Make internal for now 2025-07-08 17:11:52 +09:00
Dan Balasescu
cd9fc864ad Explain when the property is initialised 2025-07-08 17:09:17 +09:00
Dan Balasescu
d31d3918c4 Move static to DebugUtils + document + cleanup reference 2025-07-08 16:27:54 +09:00
Susko3
b620e6fcb7 Move get entry assembly api to RuntimeInfo
A better place for it, as the entry assembly is queried in non-"debug" situations.
2024-01-31 23:55:13 +01:00
Susko3
fb713e13ab Use safer assembly name checks
Using `Location` would give the absolute path of the assembly, which could wrongly
match if it was in a subfolder named "testhost" or "ReSharperTestRunner".
2023-07-23 21:34:28 +02:00
Susko3
bad00445dd Add Assembly.GetEntryAssembly() to banned symbols 2023-02-02 22:29:58 +01:00
Susko3
e8f9e5e74f Update nullability of EntryAssembly 2023-02-02 22:28:31 +01:00
Susko3
787e44dd43 Use EntryAssembly in DebugUtils.GetEntryAssembly()
This partially reverts 0a610f15ce
by removing the `Assembly.GetCallingAssembly()` fallback.
2023-01-15 17:13:12 +01:00
Susko3
821b747aa2 Rename EntryAssembly and static-initialise to GetEntryAssembly() 2023-01-15 17:10:22 +01:00
Susko3
e3fcd01af3 Fix DebugUtils.IsDebugBuild not working on Android 2022-12-31 01:09:19 +01:00
Susko3
ebfdd451f0 Apply NRT to DebugUtils 2022-12-31 01:04:05 +01:00
Dean Herbert
63405204eb Apply NRT to all low-hanging fruit 2022-11-16 19:12:44 +09:00
Dean Herbert
5012f8572e Clean up various obsoleted code 2022-10-28 13:25:50 +09:00
Susko3
50f506146b Use AsNonNull() where applicable 2022-10-05 23:46:44 +02:00
Dan Balasescu
ba1385330c Automated #nullable processing 2022-06-13 21:57:05 +09:00
ekrctb
7e6e48c4d3 Fix additional inspections arisen after previous batch fix 2021-10-27 21:29:50 +09:00
ekrctb
dde9eb08ed Apply "use explict type (built-in types)" inspection fix 2021-10-27 20:51:35 +09:00
smoogipoo
9845741f76 Remove unused using 2021-08-11 13:13:26 +09:00
Dean Herbert
18614364d7 Redirect and add obsoletion notice 2021-08-11 12:58:19 +09:00
smoogipoo
41661e4c19 Add blurb about only aserting in debug mode 2021-04-26 18:37:38 +09:00
smoogipoo
c9f2442040 Internalise EnsureX() methods 2021-04-26 18:36:40 +09:00
smoogipoo
4dd72e96a9 Add EnsureInputThread() 2021-04-26 18:30:48 +09:00
smoogipoo
18ec83838f Expose ThreadSafety 2021-04-26 18:13:15 +09:00
Dean Herbert
3e61d2bbd2 Replace local implementation of EnumerateBaseTypes 2021-03-09 19:01:53 +09:00
Bartłomiej Dach
539b9583ef Fix incorrect entry assembly selection on mobile
On Android, `Assembly.GetEntryAssembly()` returns `null`. That is not at
all surprising, as per the docs, there *is no* entry assembly - the game
is being ran through mono.

`DebugUtils`'s entry assembly detection code would wrongly assume that
if the entry assembly as given by the CLR is null, then the game was
being ran in a test context. Therefore, on Android, all `DebugUtils`
members that utilised the assembly detection, would use the properties
of the `nunit.framework` assembly, instead of the executing assembly.

The reason why the `nunit.framework` assembly was chosen was that if an
NUnit test context is requested outside of an actual test, NUnit will
make up its own context (with the class name of
`TestExecutionContext.AdhocContext`). That class resides in
`nunit.framework`.

Recent upstream NUnit changes (enabling SourceLink support and shipping
portable debug symbols) have caused this to trip over at the game side,
and game builds in release configuration would show as debug builds.

To resolve, leverage the `AdhocContext` in order to determine if we are
running in the context of a particular, actual test. This makes it so
that on Android, `DebugUtils.GetEntryAssembly()` will now defer to the
executing assembly, and fix the wrong values of `IsDebugBuild`
and similar.
2021-02-20 19:07:25 +01:00
Dean Herbert
40118922ba Add NUnit licence header 2021-02-08 16:49:42 +09:00
Dean Herbert
45d13b3709 Update NUnit and pull in dependent (removed) code locally 2021-02-08 16:47:29 +09:00
smoogipoo
f4d7a76633 Fix unit tests under Rider 2020.2 EAP6 2020-07-13 15:23:53 +09:00
Salman Ahmed
dc28c46b67 Use nunit_test_assembly to determine the entry path as well 2020-05-31 13:29:11 +03:00
Salman Ahmed
550468e0f9 Fix running a unit test method directly crashes
FullName will conclude the method name if it was run directly
2020-05-30 17:42:36 +03:00
Salman Ahmed
1381c3a2da Replace host assembly as entry with NUnit current test assembly 2020-05-29 12:01:24 +03:00
Dean Herbert
12a145c3dc Add exception to allow audio thread operations to run inline on update thread in single-threaded mode 2020-02-28 15:45:04 +09:00
Dean Herbert
4d0078eb0f Correctly reset ThreadSafety values on single threaded context change 2020-02-28 13:11:45 +09:00
Dean Herbert
1702b2a49c Merge branch 'improve-thread-safety' into single-threaded-mode 2020-02-28 13:01:33 +09:00
Dean Herbert
ac3eff08c2 Use ThreadStatic for ThreadSafety implementation 2020-02-28 12:14:44 +09:00
Dean Herbert
2089a01d9a Merge branch 'frame-time-display-accuracy' into single-threaded-mode 2020-02-27 16:46:30 +09:00
Dean Herbert
a43f8b68e7 Add missing parentheses 2020-02-27 13:40:05 +09:00
Dean Herbert
e0dd707920 Remove debug performance logging setting, instead making it activate when GlobalStatistics is open 2020-02-26 17:22:48 +09:00
Dean Herbert
1e4813594b Fix freezes with blocking audio actions 2020-02-24 22:56:50 +09:00
Dean Herbert
e4241d2e06 Add ability to toggle between single and multi-threaded execution 2020-02-24 13:14:23 +09:00
Dean Herbert
c0710efc8d Fix xmldoc reference 2019-11-22 12:56:29 +09:00
Dean Herbert
e685e6d00d Fix incorrect working directory when a nuget framework consumer is consumed by another project 2019-09-05 01:02:19 +09:00
Dean Herbert
20c9996b31 Lock non-background thread only when performance logging is enabled 2019-06-20 12:53:23 +09:00
Dan Silk
0a610f15ce Add null check for debug check and fallback to Calling assembly
This is in cases, such as Android, where the Entry Assembly is NULL due to unmanaged calls.
2019-06-12 20:16:06 +09:30
Dean Herbert
c7ff1d4be9 Move NUnitRunning to DebugUtils and improve entry assembly lookup 2019-04-25 13:41:17 +09:00
Dean Herbert
32322bfbf7 Fix logger not outputting when running a consumer project under nUnit 2019-04-24 19:26:30 +09:00
smoogipoo
a5508f1bd9 Fix warnings 2019-03-28 18:49:06 +09:00
smoogipoo
02eb391e7a Force IsDebugBuild=true always on debug builds 2019-03-28 15:20:09 +09:00
Dean Herbert
fb3029668d Update licence header (and remove year) 2019-01-24 17:59:35 +09:00
ekrctb
c3a6d5ab80 Use ThreadLocal for ThreadSafety static properties.
Performance impact should be reduced.
2018-12-28 20:02:27 +09:00