From 78d12e82f4230601982f5d26c888a86e389d6dcd Mon Sep 17 00:00:00 2001 From: hui-zhou-a Date: Fri, 27 Mar 2026 12:46:41 +0100 Subject: [PATCH 1/7] FIX: remove dotnetcore2 --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index c087961ede..ae696ce5fb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,7 +29,6 @@ dependencies = [ "cffi>=1.16.0,<2.1; platform_system=='Linux'", "pywin32>=308;platform_system=='Windows'", "ansys-pythonnet>=3.1.0rc6", - "dotnetcore2==3.1.23;platform_system=='Linux'", # Core dependencies "numpy>=1.20.0,<3", "pydantic>=2.6.4,<2.13", From 9764103b848252cbf40596e80507e9d6d99521cb Mon Sep 17 00:00:00 2001 From: pyansys-ci-bot <92810346+pyansys-ci-bot@users.noreply.github.com> Date: Fri, 27 Mar 2026 11:49:32 +0000 Subject: [PATCH 2/7] chore: adding changelog file 1972.fixed.md [dependabot-skip] --- doc/changelog.d/1972.fixed.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/changelog.d/1972.fixed.md diff --git a/doc/changelog.d/1972.fixed.md b/doc/changelog.d/1972.fixed.md new file mode 100644 index 0000000000..0980408983 --- /dev/null +++ b/doc/changelog.d/1972.fixed.md @@ -0,0 +1 @@ +Remove dotnetcore2 From 53fc5835b34d62d1cb8104d7f5a31ce04df124f3 Mon Sep 17 00:00:00 2001 From: hui-zhou-a Date: Fri, 27 Mar 2026 12:51:11 +0100 Subject: [PATCH 3/7] minor --- src/pyedb/dotnet/clr_module.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/pyedb/dotnet/clr_module.py b/src/pyedb/dotnet/clr_module.py index 50a38bb375..b35843971e 100644 --- a/src/pyedb/dotnet/clr_module.py +++ b/src/pyedb/dotnet/clr_module.py @@ -72,15 +72,9 @@ def custom_show_warning(message, category, filename, lineno, file=None, line=Non is_clr = True # TODO: Fall backing to dotnetcore2 should be removed in a near future. except Exception: - warnings.warn( - "Unable to set .NET root and locate the runtime configuration file. Falling back to using dotnetcore2." - ) - warnings.warn(LINUX_WARNING) - - import dotnetcore2 - - dotnet_root = Path(dotnetcore2.__file__).parent / "bin" - runtime_config = pyedb_path / "misc" / "pyedb.runtimeconfig.json" + raise RuntimeError(".NET is not found. For more information, see" + "https://aedt.docs.pyansys.com/version/stable/release_1_0.html#dotnet-changes-in-linux" + ) # Use specified .NET root folder else: dotnet_root = Path(os.environ["DOTNET_ROOT"]) From 585effd804e0217573d1f134c532a8b6e4be7f59 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 27 Mar 2026 11:51:58 +0000 Subject: [PATCH 4/7] CHORE: Auto fixes from pre-commit hooks --- src/pyedb/dotnet/clr_module.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/pyedb/dotnet/clr_module.py b/src/pyedb/dotnet/clr_module.py index b35843971e..be2d6b6223 100644 --- a/src/pyedb/dotnet/clr_module.py +++ b/src/pyedb/dotnet/clr_module.py @@ -72,9 +72,10 @@ def custom_show_warning(message, category, filename, lineno, file=None, line=Non is_clr = True # TODO: Fall backing to dotnetcore2 should be removed in a near future. except Exception: - raise RuntimeError(".NET is not found. For more information, see" - "https://aedt.docs.pyansys.com/version/stable/release_1_0.html#dotnet-changes-in-linux" - ) + raise RuntimeError( + ".NET is not found. For more information, see" + "https://aedt.docs.pyansys.com/version/stable/release_1_0.html#dotnet-changes-in-linux" + ) # Use specified .NET root folder else: dotnet_root = Path(os.environ["DOTNET_ROOT"]) From 8812fb48ae1a2f8dc6130bf882bbf9e3ada3bb71 Mon Sep 17 00:00:00 2001 From: hui-zhou-a Date: Fri, 27 Mar 2026 12:52:36 +0100 Subject: [PATCH 5/7] minor --- src/pyedb/dotnet/clr_module.py | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/src/pyedb/dotnet/clr_module.py b/src/pyedb/dotnet/clr_module.py index b35843971e..26be557482 100644 --- a/src/pyedb/dotnet/clr_module.py +++ b/src/pyedb/dotnet/clr_module.py @@ -70,7 +70,6 @@ def custom_show_warning(message, category, filename, lineno, file=None, line=Non load(runtime) os.environ["DOTNET_ROOT"] = runtime.dotnet_root.as_posix() is_clr = True - # TODO: Fall backing to dotnetcore2 should be removed in a near future. except Exception: raise RuntimeError(".NET is not found. For more information, see" "https://aedt.docs.pyansys.com/version/stable/release_1_0.html#dotnet-changes-in-linux" @@ -78,23 +77,18 @@ def custom_show_warning(message, category, filename, lineno, file=None, line=Non # Use specified .NET root folder else: dotnet_root = Path(os.environ["DOTNET_ROOT"]) - # Patch the case where DOTNET_ROOT leads to dotnetcore2 for more information - # see https://github.com/ansys/pyedb/issues/922 - # TODO: Remove once dotnetcore2 is deprecated - if dotnet_root.parent.name == "dotnetcore2": - runtime_config = pyedb_path / "misc" / "pyedb.runtimeconfig.json" - else: - from clr_loader import find_runtimes - - candidates = [rt for rt in find_runtimes() if rt.name == "Microsoft.NETCore.App"] - candidates.sort(key=lambda spec: spec.version, reverse=True) - if not candidates: - raise RuntimeError( - "Configuration file could not be found from DOTNET_ROOT. " - "Please ensure that .NET SDK is correctly installed or " - "that DOTNET_ROOT is correctly set." - ) - runtime_spec = candidates[0] + + from clr_loader import find_runtimes + + candidates = [rt for rt in find_runtimes() if rt.name == "Microsoft.NETCore.App"] + candidates.sort(key=lambda spec: spec.version, reverse=True) + if not candidates: + raise RuntimeError( + "Configuration file could not be found from DOTNET_ROOT. " + "Please ensure that .NET SDK is correctly installed or " + "that DOTNET_ROOT is correctly set." + ) + runtime_spec = candidates[0] # Use specific .NET core runtime if dotnet_root is not None and (runtime_config is not None or runtime_spec is not None): try: From a576a38795eac8fea8aeadd7b3432f558854f8af Mon Sep 17 00:00:00 2001 From: hui-zhou-a Date: Fri, 27 Mar 2026 12:54:28 +0100 Subject: [PATCH 6/7] minor --- src/pyedb/dotnet/clr_module.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pyedb/dotnet/clr_module.py b/src/pyedb/dotnet/clr_module.py index cbcca76432..5a4f14b96f 100644 --- a/src/pyedb/dotnet/clr_module.py +++ b/src/pyedb/dotnet/clr_module.py @@ -61,7 +61,7 @@ def custom_show_warning(message, category, filename, lineno, file=None, line=Non dotnet_root = None runtime_config = None runtime_spec = None - # Use system .NET core runtime or fall back to dotnetcore2 + # Use system .NET core runtime if os.environ.get("DOTNET_ROOT") is None: try: from clr_loader import get_coreclr From 832a758b71561c5a24bf97744acaafde3a047bb7 Mon Sep 17 00:00:00 2001 From: hui-zhou-a Date: Fri, 27 Mar 2026 13:03:29 +0100 Subject: [PATCH 7/7] minor --- tests/unit/test_clr_module.py | 59 ----------------------------------- 1 file changed, 59 deletions(-) diff --git a/tests/unit/test_clr_module.py b/tests/unit/test_clr_module.py index 7e4029f22e..91fd426de8 100644 --- a/tests/unit/test_clr_module.py +++ b/tests/unit/test_clr_module.py @@ -29,8 +29,6 @@ DOTNET_ROOT = "dummy/root/path" DOTNET_ROOT_PATH = Path(DOTNET_ROOT) -DOTNETCORE2_FILE = "dummy/dotnetcore2/file" -DOTNETCORE2_BIN = "dummy/dotnetcore2/bin" PYEDB_FILE = "dummy/pyedb/file" @@ -65,60 +63,3 @@ def test_use_system_dotnet(mock_get_coreclr, mock_load, clean_environment): assert cm.is_clr assert DOTNET_ROOT_PATH.as_posix() == os.environ["DOTNET_ROOT"] del os.environ["DOTNET_ROOT"] - - -@pytest.mark.skipif(os.name != "posix", reason="test for linux behavior") -@patch("dotnetcore2.__file__", new=DOTNETCORE2_FILE) -@patch("pythonnet.load") -@patch("clr_loader.get_coreclr", side_effect=Exception("Dummy exception")) -def test_use_dotnetcore2(mock_get_coreclr, mock_load, clean_environment, capsys): - import pyedb.dotnet.clr_module as cm - - captured = capsys.readouterr() - from pyedb.dotnet.clr_module import LINUX_WARNING - - assert cm.is_clr - assert DOTNETCORE2_BIN == os.environ["DOTNET_ROOT"] - assert LINUX_WARNING in captured.out - - -@pytest.mark.skipif(os.name != "posix", reason="test for linux behavior") -@patch("dotnetcore2.__file__", new=DOTNETCORE2_FILE) -@patch("pythonnet.load") -@patch("clr_loader.find_runtimes", return_value=[]) -def test_use_dotnet_root_env_variable_failure(mock_find_runtimes, mock_load, clean_environment, capsys): - os.environ["DOTNET_ROOT"] = DOTNET_ROOT - - with pytest.raises(RuntimeError): - import pyedb.dotnet.clr_module # noqa: F401 - - -@pytest.mark.skipif(os.name != "posix", reason="test for linux behavior") -@patch("dotnetcore2.__file__", new=DOTNETCORE2_FILE) -@patch("pythonnet.load") -def test_use_dotnet_root_env_variable_success_dotnetcore2(mock_load, clean_environment, capsys): - os.environ["DOTNET_ROOT"] = DOTNETCORE2_BIN - - import pyedb.dotnet.clr_module as cm - - captured = capsys.readouterr() - from pyedb.dotnet.clr_module import LINUX_WARNING - - assert cm.is_clr - assert DOTNETCORE2_BIN == os.environ["DOTNET_ROOT"] - assert LINUX_WARNING not in captured.out - - -@pytest.mark.skipif(os.name != "posix", reason="test for linux behavior") -@patch("dotnetcore2.__file__", new=DOTNETCORE2_FILE) -@patch("pythonnet.load") -@patch("clr_loader.find_runtimes") -def test_use_dotnet_root_env_variable_success(mock_find_runtimes, mock_load, clean_environment, capsys): - os.environ["DOTNET_ROOT"] = DOTNET_ROOT - mock_runtime = MagicMock() - mock_runtime.name = "Microsoft.NETCore.App" - mock_find_runtimes.return_value = [mock_runtime] - - import pyedb.dotnet.clr_module # noqa: F401 - - assert os.environ["DOTNET_ROOT"]