-
Notifications
You must be signed in to change notification settings - Fork 366
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
Use reflection to implement SettingsEntity.NewInstance #1281
Conversation
Fixes #1282 |
@matkoch thanks for the response. I hadn’t noticed that other pull request.
Practically speaking: I had a quick look at #1247.
🤷 thanks |
@borland thanks for taking the time, but unfortunately, I'm gonna have to close this PR (and the other too). Both have failing tests (yours in Generally speaking, I've decided against fixing this for .NET 8 and will see to approach this another time for .NET 9. If you want to test the alpha build, it's version |
@matkoch that is dissapointing. It means that many projects which use Nuke will need to work around this and add I'm not sure if this was clear earlier: This doesn't affect just Nuke itself (if it did, fair enough if you want to defer it), but the error propagates to all projects using Nuke. Additionally, the out-of-box experience for a newly created project on .NET 8 may not work unless the user stumbles into one of the GitHub issues here and discovers the workaround. If the other failing tests and lookup table code are your main concern, would you reconsider accepting the PR if I fixed them? I'd be more than happy to do so, I simply wasn't aware of these earlier. |
@borland, I'm as disappointed as you, but, unfortunately, neither me nor the PRs were able to fix this in time. Right now, I'm knee-deep in my daily job, so I'm not very keen to test and review another attempt. What I would like to do, is to push a version that makes it working with .NET 8. And suppressing the warning is the easiest solution.
I'm well aware of that, but maybe you've missed the commit I referred to. Have you tried the alpha version?
Again, the commit should fix that. That's why I'm asking for feedback on the alpha version. Same as on Slack, but I barely got a single reaction, which is ... odd ... considering how much demand there was here. There's one caveat to projects that only transitively reference |
Thanks for the further response @matkoch. I wasn’t in position to try the alpha build earlier, I’ll give it a try on our projects and let you know the outcome. |
Hi @matkoch I updated my project to add After running a dotnet restore then running
This makes sense - in your linked commit 63607c5 I can see you've added NoWarn for For reference: My repository root has a |
@borland, clean your
This is incorrect. The changes are defined in If this is still broken for you, then I need a proper repro. |
@matkoch thanks for that. I always forget that the nuke alphas always have the same version so require the cache-clean step.
Everything worked, I recieved this output
While I am slightly surprised to learn that Microsoft allows NuGet packages to declare themselves exempt from security warnings using a props file like this 🤦, I don't fault you for taking advantage of it to solve the problem 😄. Thanks for taking the time to discuss! |
The current implementation of SettingsEntity.NewInstance uses a roundtrip through
BinaryFormatter
as a way to clone objects.When running Nuke on .NET 8 RC2, I observe this warning in the log when using an
[OctoVersionAttribute]
More discussion and workaround in Issue #1282
Fix
This pull request removes BinaryFormatter from Nuke, and uses reflection to clone
ISettingsEntity
objects instead.Quality
I've added some unit tests around the
NewInstance
method, covering various things that might be contained in anISettingsEntity
object and asserting they are cloned correctly. I would be more than happy to add additional tests if there are additional data types or object shapes that might be of concern.I confirm that the pull-request: