maui
maui copied to clipboard
Compile Error: "The type or namespace name 'MauiUIApplicationDelegate' could not be found" in latest nightly builds
Description
Since sometime last week, I get this compile error when I try to compile my .NET MAUI Project using the latest nightly build:
The type or namespace name 'MauiUIApplicationDelegate' could not be found (are you missing a using directive or an assembly reference?)
First of all, I thought one of the nightly builds did not get built correctly, but I still get this compile error, e.g. when I use the build from tonight: <MauiVersion>8.0.7-nightly.9895</MauiVersion>.
The Referenced <MauiVersion>8.0.6-nightly.9880</MauiVersion> is still working. After that, I get this compile error.
Was there a breaking change or am I missing something now?
This also leads to an compile error for these lines at the MauiPicker and this.PlatformView.EndEditing(true); as well as this.PlatformView.InputAccessoryView = toolbar; cannot be compiled anymore and lead to compile errors:
protected override void ConnectHandler(MauiPicker platformView)
{
base.ConnectHandler(platformView);
var toolbar = (UIToolbar)platformView.InputAccessoryView;
// Set custom text for the Done button
var doneButtonText = new NSString(AppResources.DoneButtonText);
DoneButton = new UIBarButtonItem(doneButtonText, UIBarButtonItemStyle.Done, (sender, e) =>
{
this.PlatformView.EndEditing(true);
});
// Add the button to the toolbar previously created
toolbar.Items = new UIBarButtonItem[]
{
new UIBarButtonItem (UIBarButtonSystemItem.FlexibleSpace),
DoneButton
};
this.PlatformView.InputAccessoryView = toolbar;
}
Also the MauiTextField and .InputAccessoryView not available anymore:
protected override void ConnectHandler(MauiTextField platformView)
{
base.ConnectHandler(platformView);
// Create a new toolbar.
var toolbar = new UIToolbar(new RectangleF(0.0f, 0.0f, 50.0f, 44.0f));
// Set custom text for the Done button
var doneButtonText = new NSString(AppResources.DoneButtonText);
DoneButton = new UIBarButtonItem(doneButtonText, UIBarButtonItemStyle.Done, (sender, e) =>
{
this.PlatformView.EndEditing(true);
});
// Add the button to the toolbar previously created
toolbar.Items = new UIBarButtonItem[]
{
new UIBarButtonItem (UIBarButtonSystemItem.FlexibleSpace),
DoneButton
};
this.PlatformView.InputAccessoryView = toolbar;
}
Steps to Reproduce
- Use
<MauiVersion>8.0.6-nightly.9880</MauiVersion>in csproj and see it still works - Use
<MauiVersion>8.0.7-nightly.9895</MauiVersion>in csproj and see the compile is broken and does not work anymore
Hint: I also cleared the NuGet-Packages and made sure the .nuget-Packages folder is completely empty. Did not help
Link to public reproduction project repository
No response
Version with bug
8.0.7-nightly.9895 or everything >= 8.0.6-nightly.9889
Is this a regression from previous behavior?
Yes, this used to work in .NET MAUI
Last version that worked well
8.0.6-nightly.9880
Affected platforms
iOS, Android
Affected platform versions
No response
Did you find any workaround?
No response
Relevant log output
No response
Good question is how others in this project can work with the latest builds when nothing works anymore - I am confused
Hi @MAUIoxo. We have added the "s/needs-repro" label to this issue, which indicates that we require steps and sample code to reproduce the issue before we can take further action. Please try to create a minimal sample project/solution or code samples which reproduce the issue, ideally as a GitHub repo that we can clone. See more details about creating repros here: https://github.com/dotnet/maui/blob/main/.github/repro.md
This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.
@MAUIoxo can you attach a repro so we can see your project setup as well?
Same but if i switch to use VS 2022 Preview then no problem
@PureWeen Same issue with 8.0.7-preview.9929+sha.1c0c601f71-azdo.8979728.
The interesting thing for me was that I had to reinstall my PC and installed VS Version 17.9.0 Preview 5.0 used this <MauiVersion>8.0.7-preview.9929</MauiVersion> and the error was gone. Previous VS 17.9 Previw version did not work when I reported this issue. Is there any correlation?
@PureWeen Same issue with 8.0.7-preview.9929+sha.1c0c601f71-azdo.8979728.
I also see this with 8.0.7 final (when targeting iOS or Mac). I'm building with SDK version 8.0.200 on MacOS.
@PureWeen Same issue with 8.0.7-preview.9929+sha.1c0c601f71-azdo.8979728.
I also see this with 8.0.7 final (when targeting iOS or Mac). I'm building with SDK version 8.0.200 on MacOS.
Same here. I'm using Directory.Packages.props file to manually set versions on Microsoft.Maui.Controls and Microsoft.Maui.Controls.Compatibility. If I use $(MauiVersion) it reports "8.0.6".
If I compare my MAUI project to the default new project, I have AppDelegate.cs in
namespace NetworkVisor.Platform.Test.Maui
vs.
namespace Maui
for the default project.
<ItemGroup>
<PackageVersion Include="Microsoft.Maui.Controls" Version="8.0.7" />
<PackageVersion Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.7" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
</ItemGroup>
I also see this with 8.0.7 final (when targeting iOS or Mac). I'm building with SDK version 8.0.200 on MacOS.
I actually suspect that the problem is related to the SDK version, since I don't see it on another machine (with SDK 8.0.100).
I actually suspect that the problem is related to the SDK version, since I don't see it on another machine (with SDK 8.0.100).
Turns out this is not the case, after all. Uninstalling SDK 8.0.200 did not help. Instead it seems like the problem (in my case) may be related to outdated workloads:
% dotnet workload list
Installed Workload Id Manifest Version Installation Source
--------------------------------------------------------------------------------
maui-tizen 8.0.0-rc.1.9171/8.0.100-rc.1 SDK 8.0.100
maui-maccatalyst 8.0.0-rc.1.9171/8.0.100-rc.1 SDK 8.0.100
maui-ios 8.0.0-rc.1.9171/8.0.100-rc.1 SDK 8.0.100
maui-android 8.0.0-rc.1.9171/8.0.100-rc.1 SDK 8.0.100
Use `dotnet workload search` to find additional workloads to install.
Updates are available for the following workload(s): maui-tizen maui-maccatalyst maui-ios maui-android. Run `dotnet workload update` to get the latest.
This reports that updates are available, but after running sudo dotnet workload update, the output is still the same and nothing is updated.
The output of the update command includes lines like:
Installing workload manifest microsoft.net.sdk.maui version 8.0.6...
But then later:
Garbage collecting for SDK feature band(s) 6.0.400 7.0.100 7.0.200 7.0.300 8.0.100...
[..]
Uninstalling workload manifest microsoft.net.sdk.maui version 8.0.6/8.0.100...
[..]
Very puzzling. 🤔 Does anyone have an idea what might be the reason for this strange behavior?
Very puzzling. 🤔 Does anyone have an idea what might be the reason for this strange behavior?
I had the suspicion that I had remnants of old pre-release SDK versions in my setup, so I wiped out the complete dotnet folder (/usr/local/share/dotnet on MacOS), reinstalled the .NET 6 and 7 SDKs via the VS4Mac installer plus SDK 8.0.200 (downloaded manually).
However, after restoring workloads in such a fresh setup, I again ended up with the same funny 8.0.0-rc.1.9171 versions shown above. 🤯
AFAICS this must be some problem with SDK 8.0.200 after all?!? (Note: I'm on an M1 MacBook, so I'm using the Arm64 variant of the SDK.)
Very puzzling. 🤔 Does anyone have an idea what might be the reason for this strange behavior?
I had the suspicion that I had remnants of old pre-release SDK versions in my setup, so I wiped out the complete dotnet folder (
/usr/local/share/dotneton MacOS), reinstalled the .NET 6 and 7 SDKs via the VS4Mac installer plus SDK 8.0.200 (downloaded manually).However, after restoring workloads in such a fresh setup, I again ended up with the same funny
8.0.0-rc.1.9171versions shown above. 🤯AFAICS this must be some problem with SDK 8.0.200 after all?!? (Note: I'm on an M1 MacBook, so I'm using the Arm64 variant of the SDK.)
Another fresh installation with SDK 8.0.101 gives me "good" workload versions (8.0.6/8.0.100), so I'd like to insist that 8.0.200 is broken 😵
Looks like this is a general issue with 8.0.200 and Maui workloads. #20600
This should be fixed by installing 8.0.201. If not please let us know in the above linked issue.