v10: Fix build warnings in Web.Common#12349
Conversation
# Conflicts: # src/Umbraco.Web.Common/ModelsBuilder/InMemoryModelFactory.cs
nikolajlauridsen
left a comment
There was a problem hiding this comment.
Code overall looks good to me 👍, only found a couple of minor things :D Also din't find any new obsolete attributes, so looks like you caught em all :)
I haven't tested this yet though
src/Umbraco.Web.Common/Filters/ValidateUmbracoFormRouteStringAttribute.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>
…ttribute.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>
…b.Common' into v10/bugfix/fix-build-warnings-Web.Common
# Conflicts: # src/Umbraco.Web.Common/Hosting/UmbracoHostBuilderDecorator.cs
|
It seems after merging these changing into In If I change line https://github.com/umbraco/Umbraco-CMS/pull/12349/files#diff-f9c020492385e8ed7a6066d6edafd07b849779a3c533eeb24995235b93f6329bR42 the following instead the code compiles as // cc @bergmania |
|
Hey @bjarnef I'm not seeing a compile error on either v10/dev or v10/contrib You've linked to a line, but the link doesn't seem to work for me, just takes me to the changes :( |
|
@Zeegaan the link should work, but you may need to click "Load diff" at UmbracoViewPage to see the linked line: Strange that it is your screenshot says When I inspect |
|
@bjarnef Really strange indeed, I've just switched to my laptop to test aswell, seems like its also not nullable there 🤔 |
|
Currently I have .NET v6.0.101 installed :) |
|
@bjarnef Seems like that is the issue! |
|
@Zeegaan strange if it has changed in a patch update of .NET6 🤔 |
|
@bjarnef I'd personally consider wrong nullability a bug, so i don't see why that cannot change in a patch 🤔 Heres the PR that changed it to non-nullable in 6.0.2 |
|
@Zeegaan okay, maybe it should be mentioned in the contributing guide that it now requires .NET 6.0.2+ 😁 // cc @nul800sebastiaan @bergmania |
|
Well that is terribly annoying! Fixed: https://github.com/umbraco/Umbraco-CMS/blob/v10/contrib/.github/BUILD.md#debugging-with-vs-code But also needs to be fixed in the docs for minimum requirements. |
* Fixed issues with basic auth middleware to support Umbraco Cloud usecase * Fix redirects to return url, now allows website urls * Strip potential domain part of returnPath * Fix default value in appsettings schema * Reintroduce check of basic auth enabled. * Fix wrong negation introduced in #12349 * Fixed issues with redirects * Also check external login cookie, while authenticating backoffice
* Fixed issues with basic auth middleware to support Umbraco Cloud usecase * Fix redirects to return url, now allows website urls * Strip potential domain part of returnPath * Fix default value in appsettings schema * Reintroduce check of basic auth enabled. * Fix wrong negation introduced in #12349 * Fixed issues with redirects * Also check external login cookie, while authenticating backoffice
| if (!(content is null)) | ||
| { | ||
| _helper.AssignedContentItem = content; | ||
| } |
There was a problem hiding this comment.
@Zeegaan couldn't this part be simplified to:
TModel model = ViewData.Model;
var content = model as IPublishedContent;
if (content is null && model is IContentModel contentModel)
{
content = contentModel.Content;
}
_helper = Context.RequestServices.GetRequiredService<UmbracoHelper>();
content ??= UmbracoContext?.PublishedRequest?.PublishedContent;
if (content is not null)
{
_helper.AssignedContentItem = content;
}
There was a problem hiding this comment.
Hey @bjarnef you are totally right that could be simplified, could i trouble you to make a PR with the changes? I will gladly review it 😄







Notes
Removed lots of warnings again, i think the interesting stuff is all the redundant "?" checks, cause even though the compiler will give a warning for some of them, its not all that are actually redudant (see the fix test commit, some where failing cause i had removed the ? checks)
Like in V10: Build warnings in Web.Website #12332 please be aware of the [Obsolete] attrubute, dotnet format adds these when using obsolete methods -.-
How to test
globalconfigfile