Skip to content

Add SafeMode option to test settings for Excel launch#27

Open
novitk wants to merge 1 commit intoExcel-DNA:masterfrom
novitk:master
Open

Add SafeMode option to test settings for Excel launch#27
novitk wants to merge 1 commit intoExcel-DNA:masterfrom
novitk:master

Conversation

@novitk
Copy link
Copy Markdown

@novitk novitk commented Apr 15, 2026

Introduce SafeMode property to ExcelFactAttribute, ExcelTestSettingsAttribute, allowing tests to specify launching Excel in safe mode (/safe). This basically allows to run tests in working area that avoids conflicts with other addins.

Introduce SafeMode property to ExcelFactAttribute, ExcelTestSettingsAttribute, ITestSettings, and ExcelTestSettings, allowing tests to specify launching Excel in safe mode (/safe). Update ExcelRunner and ExcelTestAssemblyRunner to support this option, and ensure SafeMode is serialized in ExcelTestCase. Improves test isolation and reliability by enabling safe mode for specific test cases. Documentation updated accordingly.

Add support for running tests in Excel Safe Mode

Introduce a SafeMode property to test settings, attributes, and runners, enabling Excel to be launched with the /safe switch for selected tests. Update process launching, test case serialization, and test discovery to support Safe Mode. Add a sample test using Safe Mode to improve test isolation and reliability.
@Sergey-Vlasov
Copy link
Copy Markdown
Contributor

What about adding a more general string ExcelArguments (?) option instead of bool SafeMode?

And add an additional example test instead of modifying existing FunctionTestNET6().

@novitk
Copy link
Copy Markdown
Author

novitk commented Apr 22, 2026

What about adding a more general string ExcelArguments (?) option instead of bool SafeMode?
was thinking about it, but decided against it. Three reason: don't see much practical usage, extra complexity(a need for a dictionary per string), explicitness(people may not be aware of safety mode to begin with).

And add an additional example test instead of modifying existing FunctionTestNET6()
Actually both tests don't run together for me on master. The box pops up with:
ExampleAddinNET8 Add-In - ExcelDna.Host
The required .NET Desktop Runtime 8.0.0 x64 is incompatible with the runtime 10.0.3 already loaded in the process.
You can try to disable other Excel add-ins to resolve the conflict.

as /safe runs its own excel instance it was a cheap way to make both instances work.

Feel free to modify or drop in whatever way you'd like though. I moved away from using this project to reduce dependencies and complexity - just spinning Excel directly in xunit fixture was simple enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants