Comments (5)
Hi I'm an AI powered bot that finds similar issues based off the issue title.
Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!
Closed similar issues:
- 'Platform' does not contain a definition for 'Init' (#21253), similarity score: 0.87
- Another - Error CS0246: The type or namespace name 'MauiUIApplicationDelegate' could not be found (are you missing a using directive or an assembly reference?) (CS0246) (#21751), similarity score: 0.77
- .NET 8 - No reference to MauiUIApplicationDelegate and ViewRenderer<,> (#18795), similarity score: 0.76
- The type or namespace name 'MauiUIApplicationDelegate' could not be found Microsoft.AspNetCore.Components.WebView.Maui 8.0.7 (#20591), similarity score: 0.75
- error CS0234: The type or namespace name 'iOS' does not exist in the namespace 'Microsoft.Maui.Controls.Compatibility.Platform' (#20589), similarity score: 0.74
Note: You can give me feedback by thumbs upping or thumbs downing this comment.
from maui.
Added repro repo (tho it was created with just the 3 steps listed above)
from maui.
Yeah, your repro shows this working.
My guess, based on your error, is that you either have that code inside a file that is being referenced by another target framework. Even though you mentioned this happening in AppDelegate in (I think) a MAUI UI project, which I also tried and worked fine, as expected.
This would only works on iOS/Catalyst, and the single target MAUI solution targets iOS, Catalyst, Windows, and Android. So maybe you have it placed somewhere we're it's trying to be compiled for other platforms. Or maybe your IDE is targeting that file for other platforms and it's showing it as failing, but it would compile fine from CLI. My guess looking at that other issue you linked to is they had the same issue. Without having a sample project nor context into where they were typing their code, it was probably targeting the base TFM where nothing exists for Platform.
There is no change in that API from net7.0 to net8.0. IMO I don't think there's a bug here, I think it's more a configuration issue with your project and/or IDE. Could you try creating a MAUI UI project showing your issue?
from maui.
Ok, I had to do 2 things:
- Upon updating Visual Studio, it fixed it in the repro project. But it still occurred in my actual app.
- I had to change the Target OS version of the project to 17.2. Anything lower than that (even 17.0) causes this to occur, including in the sample project.
When the issue is present, if I go to the definition of Microsoft.Maui.ApplicationModel, I can see that it's because the #elif IOS || MACCATALYST
case isn't being compiled. aka IOS
isn't defined. I'm not sure why it should be necessary to both upgrade Visual Studio and change the target OS version for that to be defined, but in any event, it is an extremely unclear error that seems to crop up on multiple platforms, so it seems like there'd be a better way to handle it / report the issue to the user...?
from maui.
My best guess would be it depends on what dotnet workloads you have, and what target framework you have selected in the IDE (As in, in the Editor dropdown, did you select ios, catalyst, or android). If your code compiles in CLI but the IDE shows errors then some wires are crossed in the IDE with what it thinks it can build and run.
In any case, those are more fundamental issues with target framework support in dotnet and the IDE/Editor your using, and not something that's specific to the MAUI UI framework. That can't be addressed here. I would direct that to VSFeedback.
from maui.
Related Issues (20)
- [iOS] Shadow not visible in Button When using Clipping HOT 2
- WebAuthenticator custom headers for http client HOT 1
- [iOS] Image on Button doesn't properly centered when setting ContentLayout to Top and text has 2 or more lines. HOT 3
- When resizing the application window in Windows, if the resizing is done horizontally then elements within the window will resize correctly, but if resizing is done only vertically then resizing does not occur. HOT 2
- .NET MAUI App程序启动失败 HOT 3
- MobSF vulnerability analysis
- Android Crashes with "This window is already associated with an active Activity" when we use AppFlip HOT 3
- CollectionView DisconnectHandler SelectionMode=Multiple Windows exception HOT 2
- [Windows] App works in Debug and Release configurations but crashes in Microsoft Store HOT 3
- Suddenly, iOS crashes with “Model building is not supported when publishing with NativeAOT. Use a compiled model” HOT 6
- Can't release the C# object referenced by razor component in BlazorWebView HOT 1
- Implement DebugSettings.LayoutCycleTracingLevel HOT 1
- [Windows, 9.0 Preview 6] Fonts are randomly left out the MSIX package HOT 1
- Remove bumptech.glide.load.data java package from maui app HOT 1
- HybridWebView configuration to enable F12/browser dev tools
- HybridWebView: Clean up duplicate path manipulization/normalization code
- On Android, DateTime.ToString("F") or ("f") returns the wrong result in Japanese locale HOT 2
- IntuneMAMAppConfig returns NULL value in IOS MAUI application HOT 2
- DataTrigger does not work on Mac Catalyst HOT 2
- Page.IsBusy activity idicators gets stuck/causes multiple to be displayed HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from maui.