-
Notifications
You must be signed in to change notification settings - Fork 222
Fix C# bindings - unbreak the build and add missing partial classes #5377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Launching a C# workflow on this branch: https://github.com/NREL/OpenStudio/actions/runs/13973672884 |
|
My change is good, that error is gone, but C# bindings are still broken All projects are up-to-date for restore. |
|
It got beef with OpenStudio/src/model/ModelResources.i Lines 337 to 341 in 0f14dd3
Not sure what's up, will try to get to it tomorrow |
|
(hit the wrong button sorry) |
|
Oh ok, actually the issue is not where I thought it was, it's here: OpenStudio/src/model/ModelResources.i Lines 343 to 345 in a882f64
This happened when wrapping PythonPluginSearchPaths. It got added it the wrong location fe3461a#diff-b21ac9f937ee3830c707b3af186bb6ba53cc7a0b43fd114df09b071ed471adf7R343 |
|
Alright, locally it builds fine. Launching a C# CI run at https://github.com/NREL/OpenStudio/actions/runs/14214305608 |
|
Alright, working on CI. We have new missing partial classes though, I guess it's time to fix it. |
Not sure why it was excluded entirely, maybe just a typo? @TShapinsky FYI Last one standing is std::string_view, cf #5393
| %} | ||
|
|
||
| %ignore openstudio::alfalfa::AlfalfaComponentBase; | ||
| %ignore openstudio::alfalfa::AlfalfaComponentBase::clone; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TShapinsky not sure why it was entirely ignored, or if it was just a typo?
Not ignoring it doesn't mean you can instantiate it.
In [2]: openstudio.alfalfa.AlfalfaComponentBase()
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[2], line 1
----> 1 openstudio.alfalfa.AlfalfaComponentBase()
File /media/DataExt4/Software/Others/OS-build-release2/Products/python/openstudioalfalfa.py:141, in AlfalfaComponentBase.__init__(self, *args, **kwargs)
140 def __init__(self, *args, **kwargs):
--> 141 raise AttributeError("No constructor defined - class is abstract")
AttributeError: No constructor defined - class is abstract| #if defined(SWIGCSHARP) || defined(SWIGJAVA) | ||
| %inline { | ||
| namespace openstudio { | ||
| namespace model { | ||
|
|
||
| // AirCondVRF, reimplemented from ModelHVAC.i | ||
| std::vector<ZoneHVACTerminalUnitVariableRefrigerantFlow> terminals(const openstudio::model::AirConditionerVariableRefrigerantFlowFluidTemperatureControl& airCondVRF) { | ||
| return airCondVRF.terminals(); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An example of missing partial classes
|
@MingboPeng @arif-hanif the test step is failing, I wonder if you can help, as I don't understand the C# ecosystem enough to be honest. I think this is just because GHA (or the default .NET installer for that matter) updated their default .NET to be 8.0.0 and above, and we try to test something targeting .NET 7.0 https://github.com/NREL/OpenStudio/actions/runs/14214305608/job/39834389714#step:5:66 |
|
Actually the question might be whether we shouldn't bump the target from .NET 7 to .8 or above. Seems like it's EOL https://dotnet.microsoft.com/en-us/download/dotnet/7.0/runtime?cid=getdotnetcore&os=macos&arch=x64 |
|
Ok I found where this is defined:
|
|
is this ok though? OpenStudio/csharp/developer/OpenStudio/OpenStudio.csproj.in Lines 3 to 4 in a882f64
That seems awfully outdated? Are there any gains for bumping it to NET8 for eg? |
…HA only has NET8 and 9 currently) The alternative is to use https://github.com/actions/setup-dotnet
|
|
||
| <PropertyGroup> | ||
| <TargetFrameworks>NET7</TargetFrameworks> | ||
| <TargetFrameworks>NET7;NET8;NET9;NET10</TargetFrameworks> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is my attempt at fixing the C# test step, just allow whatever is on the GHA runner.
Launch a run at https://github.com/NREL/OpenStudio/actions/runs/14217768843
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought this would allow testing with ANY version installed in that list, but it seems that it tries to do ALL of them so the workflow is probably going to fail.
Determining projects to restore...
/usr/lib/dotnet/sdk/8.0.114/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.TargetFrameworkInference.targets(166,5): error NETSDK1045: The current .NET SDK does not support targeting .NET 9.0. Either target .NET 8.0 or lower, or use a version of the .NET SDK that supports .NET 9.0. Download the .NET SDK from https://aka.ms/dotnet/download [/media/DataExt4/Software/Others/OS-build-csharp2/Testing/csharp/OpenStudio.Tests/OpenStudio.Tests.csproj::TargetFramework=NET9]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MEH, just going to use NET8 and keep move on for now.
Launched at https://github.com/NREL/OpenStudio/actions/runs/14218506478
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok that run worked, including testing.
|
CI Results for 92336a6:
|
|
Hi @jmarrec, yes, Github Action disabled the .Net 7 by default. Just updating the test project to .Net 8 will just be fine. |
|
@joseph-robertson A quick look from you would be nice please. It's ready to drop in. |
@MingboPeng is there a gain to be had, or is it better to keep targeting old versions so it's compatible with pretty much anything? |
|
Hi @jmarrec, https://learn.microsoft.com/en-us/dotnet/standard/net-standard?tabs=net-standard-2-0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 1 out of 13 changed files in this pull request and generated no comments.
Files not reviewed (12)
- csharp/examples/OpenStudio.Tests/OpenStudio.Tests.csproj: Language not supported
- csharp/examples/OpenStudio.Tests/OpenStudio.Tests.x86.csproj: Language not supported
- src/alfalfa/Alfalfa.i: Language not supported
- src/model/ModelCore.i: Language not supported
- src/model/ModelGeometry.i: Language not supported
- src/model/ModelHVAC.i: Language not supported
- src/model/ModelResources.i: Language not supported
- src/model/ModelZoneHVAC.i: Language not supported
- src/utilities/filetypes/Filetypes.i: Language not supported
- src/utilities/filetypes/WorkflowStep.cpp: Language not supported
- src/utilities/filetypes/WorkflowStep.hpp: Language not supported
- src/utilities/xml/XMLValidator.i: Language not supported


Pull request overview
Fixes C# bindings build due to:
Add missing partial classes for c#
Pull Request Author
src/model/test)src/energyplus/Test)src/osversion/VersionTranslator.cpp)Labels:
IDDChangeAPIChangePull Request - Ready for CIso that CI builds your PRReview Checklist
This will not be exhaustively relevant to every PR.