-
Notifications
You must be signed in to change notification settings - Fork 82
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
Add .NET 7, 8, trimming and AOT support #273
base: main
Are you sure you want to change the base?
Conversation
aa64b33
to
77752ab
Compare
I'll have a look when I can, but I don't know when that will be - quite possibly not for a few weeks due to other current work. |
One initial comment before I get chance to review properly - I would strongly prefer not to target .NET 7.0, given that it will go out of support in H1 2024. It's also not clear to me why we need to explicitly target .NET 8.0, given that a .NET 6.0 target will work for .NET 8.0 - could you comment on that? Finally, it looks like quite a lot of changes are just whitespace - please revert these. (I may add an editorconfig at some point, but until then I really don't want changes that are just removing a space in a cast expression, for example.) |
@jskeet answers bellow:
That's fine and easy to change, but don't you think it could be a path forward for people who are migrating from .NET 6? We could easily remove it when it goes out of support.
AOT only became available at .NET 7+, and with very limited support. Also, diagnostics. The We need the .NET 7 or .NET 8 sdk to be able to use the But I could add .NET 6. Do you think that would be useful? It wouldn't work with AOT, though.
Sure, I'll update the PR and remove those. |
(Removing .NET 7.)
Except that's a breaking change, less than 6 months after adding it... it doesn't fell like it's worth it to me. People migrating from .NET 6 should go straight to .NET 8, which is due to be released tomorrow. I see no reason anyone would adopt .NET 7 now. Happy to accept the benefit of adding .NET 8 for AOT publishing, if we definitely need that... but is a .NET 8 target definitely needed for libraries that the app depends on? I'll need to read the docs more carefully. (That may well be the case, and would be a reason to add the target. But I only want to do that if there really is a benefit.) Will look in more detail when I get more time. |
Also fixed several nullability warnings. Signed-off-by: Giovanni Bassi <[email protected]>
Ok, if you want me to remove .NET 7 it's a simple change, just let me know. I believe I have removed all the whitespace, it was a lot of work, it would be a good idea to add an .editorconfig file and do I big commit that fixes all the code that is not conformant. Regarding the importance of AOT, I see it is a big thing for a project like this. CloudEvents are often used in function apps, which tend to start, do something and stop (if not immediately, some not long time after). They start and stop often, so startup time is important and AOT brings that. |
I didn't question the importance of AOT. I was questioning whether .NET 8 was a pre-requisite as a target framework for dependencies rather than just using the .NET 8 SDK and/or the application targeting .NET 8. |
Ok, got it. <IsAotCompatible Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net7.0'))">true</IsAotCompatible> This was added by the tooling. See docs. |
Looking at the docs, it's still not clear to me whether we really need to target .NET 8 to use AOT. I suspect the "this needs .NET 8" means "you need to be using the .NET 8 SDK" rather than "every library you depend on needs to target .NET 8". I'm going to get in touch with a friend at MS who should be able to help more on this. |
Having looked at this briefly, there's definitely more here than I'd want in one commit anyway - and I won't be able to review it in one big chunk. What I propose is that we leave this PR here, but I basically recreate it (or most of it) one step at a time. I'll start with an editorconfig and get everything to conform to that, then fix NRT issues, then move on to AOT. We can think about the minimal API sample separately. (To give a little context, I'm on a project which doesn't give me much headspace for anything big at the moment, but does let me work on bite-sized chunks. Doing this in multiple PRs is going to end up being way quicker than waiting for me to have the time to review everything in one go.) |
Sure. I can help. I'll wait for the editorconfig, when that is done let me know and we can collaborate on that. |
Editorconfig PRs are merged. When the .NET 8.0 SDK (non-RC) is out - hopefully later today - I'll install that and get on the non-nullable side. My approaches may not always match yours, mind you - but I'll try to make sure I cover everything in your PR. |
@jskeet I see you have progressed on it, do you want some help to move this forward? |
I don't have the time to do much else before January now, but if you can revise your PR to reduce it to "just the AOT stuff" that would help me check my next step |
Also fixed several nullability warnings.
Closes #272.