You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have updated the title without removing the 🚧 emoji.
Description
Fix an issue with failing tests where the tests fail on macOS Sequoia version 15.1.1.
After some disccusion back and forth and some testing myself on Windows, we discovered that the tests fail or pass in the following ways:
macOS with dotnet test command - Fail
Windows with dotnet test command - Fail
Windows using Rider - Pass
This was reported by Bonda (Velaptor contributor), that the test was failing when he was running tests on .
He reported that following exception:
Unhandledexception. System.NullReferenceException: Object reference not set to an instance of an object.
at CASL.Devices.AudioDeviceManager.DestroyDevice()in/Users/andrea/repo/personal/KinsonDigital/CASL/CASL/Devices/AudioDeviceManager.cs:line 169
at CASL.Devices.AudioDeviceManager.Dispose(Booleandisposing)in/Users/andrea/repo/personal/KinsonDigital/CASL/CASL/Devices/AudioDeviceManager.cs:line 146
at CASL.Devices.AudioDeviceManager.Finalize()in/Users/andrea/repo/personal/KinsonDigital/CASL/CASL/Devices/AudioDeviceManager.cs:line 45
The active test run was aborted.Reason: Test host process crashed : Unhandled exception.System.NullReferenceException: Object reference not set to an instance of an object.
at CASL.Devices.AudioDeviceManager.DestroyDevice()in/Users/andrea/repo/personal/KinsonDigital/CASL/CASL/Devices/AudioDeviceManager.cs:line 169
at CASL.Devices.AudioDeviceManager.Dispose(Booleandisposing)in/Users/andrea/repo/personal/KinsonDigital/CASL/CASL/Devices/AudioDeviceManager.cs:line 146
at CASL.Devices.AudioDeviceManager.Finalize()in/Users/andrea/repo/personal/KinsonDigital/CASL/CASL/Devices/AudioDeviceManager.cs:line 45
We discovered that the failure was coming from the following method:
I also discovered that the failure was occurring with the following types:
AudioDeviceManager
FullBuffer
Audio
StreamBuffer
Further investigation revealed that the reason for the failure was the timing and execution of finalizer methods depending on which OS and method of running tests.
To solve this issue, add the following static class to detect if the finalizers are being invoked from a unit test.
Details
// <copyright file="UnitTestDetector.cs" company="KinsonDigital">// Copyright (c) KinsonDigital. All rights reserved.// </copyright>namespaceCASL;usingSystem;usingSystem.Diagnostics.CodeAnalysis;/// <summary>/// Detects if the code ahs been executed from a unit test vs the rest of the application./// </summary>[ExcludeFromCodeCoverage(Justification="Do not need to see coverage for code used for testing.")]internalstaticclassUnitTestDetector{privatestaticboolisRunningFromUnitTest;/// <summary>/// Initializes static members of the <see cref="UnitTestDetector"/> class./// </summary>staticUnitTestDetector(){varassemblies=AppDomain.CurrentDomain.GetAssemblies();foreach(varassemblyinassemblies){if(string.IsNullOrEmpty(assembly.FullName)||!assembly.FullName.ToLowerInvariant().StartsWith("xunit.")){continue;}isRunningFromUnitTest=true;break;}}/// <summary>/// Gets a value indicating whether the code is being executed from a unit test./// </summary>publicstaticboolIsRunningFromUnitTest{get{
#if DEBUGreturnisRunningFromUnitTest;
#else
returnfalse;
#endif
}}}
Acceptance Criteria
The content you are editing has changed. Please copy your edits and refresh the page.
The items to complete to satisfy the Definition of Done.
Unit tests might pass locally but not in the CI environment during the status check process or vice-versa.
Tests might pass on the developer's machine but not necessarily on the code reviewer's machine.
If you notice that the test status check has passed but the test failed locally, please notify a project maintainer!
💡Warning💡
If the unit tests pass remotely and are not executed locally, this means we could be letting a bug slip into production.
Though bugs will always exist in some capacity, we should all do our part to help prevent them from happening.
Change Type Labels
Change Type
Label
Bug Fixes
🐛bug
Breaking Changes
🧨breaking-changes
New Feature
✨new-feature
CICD Changes
♻️cicd
Config Changes
⚙️config
Performance Improvements
🏎️performance
Code Doc Changes
🗒️documentation/code
Product Doc Changes
📝documentation/product
Priority Type Labels
Priority Type
Label
Low Priority
low priority
Medium Priority
medium priority
High Priority
high priority
Code of Conduct
I agree to follow this project's Code of Conduct.
The text was updated successfully, but these errors were encountered:
* Start work for issue #385
* fix: create class to detect if the code is running from a unit test
* fix: add the unit test detector check to all the finalizers
* Start work for issue #385
* fix: create class to detect if the code is running from a unit test
* fix: add the unit test detector check to all the finalizers
Complete The Item Below
Description
Fix an issue with failing tests where the tests fail on
macOS Sequoia version 15.1.1
.After some disccusion back and forth and some testing myself on Windows, we discovered that the tests fail or pass in the following ways:
dotnet test
command - Faildotnet test
command - FailThis was reported by Bonda (Velaptor contributor), that the test was failing when he was running tests on .
He reported that following exception:
We discovered that the failure was coming from the following method:
I also discovered that the failure was occurring with the following types:
AudioDeviceManager
FullBuffer
Audio
StreamBuffer
Further investigation revealed that the reason for the failure was the timing and execution of finalizer methods depending on which OS and method of running tests.
To solve this issue, add the following static class to detect if the finalizers are being invoked from a unit test.
Details
Acceptance Criteria
The items to complete to satisfy the Definition of Done.
ToDo Items
The items to complete to satisfy the Definition of Done.
Issue Dependencies
No response
Related Work
No response
Additional Information:
Unit Tests
Reasons for local unit test execution:
💡Warning💡
If the unit tests pass remotely and are not executed locally, this means we could be letting a bug slip into production.
Though bugs will always exist in some capacity, we should all do our part to help prevent them from happening.
Change Type Labels
🐛bug
🧨breaking-changes
✨new-feature
♻️cicd
⚙️config
🏎️performance
🗒️documentation/code
📝documentation/product
Priority Type Labels
low priority
medium priority
high priority
Code of Conduct
The text was updated successfully, but these errors were encountered: