MAUI Entry ClearButton does not clear the text? - c#

So earlier today I was trying to use the internal property for an Entry to clear the text in it.
<Entry
Placeholder="This is a freaky entry"
TextColor="Purple"
ClearButtonVisibility="WhileEditing"
FontSize="Large"
Keyboard="Chat"/>
But when I click on it nothing seems to happen.
Am I missing something here?
Is this the intended behaviour?
If so how do I add the clear button functionality, I don't seem to find a command or a event for it...
Version details:
When I run dotnet --version it says I am running 6.0.400
And in my VS about I have the following configuration:
Visual Studio Enterprise 2022 for Mac Preview
Version 17.4 Preview (17.4 build 715)
Installation UUID: 2aec5c48-b274-4de3-a48e-fb97472a4bd5
Runtime
.NET 6.0.5 (64-bit)
Architecture: Arm64
Roslyn (Language Service)
4.4.0-1.22371.1+c07f2571612b471671c809b5b0db59b0c37aab57
NuGet
Version: 6.2.1.2
.NET SDK (Arm64)
SDK: /usr/local/share/dotnet/sdk/6.0.400/Sdks
SDK Versions:
6.0.400
6.0.301
MSBuild SDKs: /Applications/Visual Studio (Preview).app/Contents/MonoBundle/MSBuild/Current/bin/Sdks
.NET SDK (x64)
SDK Versions:
3.1.422
3.1.420
.NET Runtime (Arm64)
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
6.0.8
6.0.6
.NET Runtime (x64)
Runtime: /usr/local/share/dotnet/x64/dotnet
Runtime Versions:
3.1.28
3.1.26
Xamarin.Profiler
Version: 1.8.0.19
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler
Updater
Version: 11
Apple Developer Tools
Xcode 13.4.1 (20504)
Build 13F100
Xamarin.Mac
Version: 8.12.0.2 (Visual Studio Enterprise)
Hash: 87f98a75e
Branch: d17-3
Build date: 2022-07-25 20:18:54-0400
Xamarin.Android
Version: 13.0.99.36 (Visual Studio Enterprise)
Commit: xamarin-android/main/b4998c8
Android SDK: /Users/jimtiyg/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
12.0 (API level 31)
11.0 (API level 30)
SDK Command-line Tools Version: 7.0
SDK Platform Tools Version: 33.0.2
SDK Build Tools Version: 33.0.0
Build Information:
Mono: dffa5ab
Java.Interop: xamarin/java.interop/main#032f1e71
SQLite: xamarin/sqlite/3.39.2#40e8743
Xamarin.Android Tools: xamarin/xamarin-android-tools/main#9c641b3
Microsoft Build of OpenJDK
Java SDK: /Library/Java/JavaVirtualMachines/microsoft-11.jdk
11.0.12
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL
Eclipse Temurin JDK
Java SDK: /Library/Java/JavaVirtualMachines/temurin-8.jdk
1.8.0.302
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL
Android SDK Manager
Version: 17.4.0.24
Hash: b3b6672
Branch: remotes/origin/HEAD~1
Build date: 2022-08-04 16:29:21 UTC
Android Device Manager
Version: 0.0.0.1179
Hash: 0f220c0
Branch: main
Build date: 2022-08-04 16:29:21 UTC
Xamarin Designer
Version: 17.4.0.32
Hash: 439b92ed7b
Branch: remotes/origin/d17-4
Build date: 2022-08-04 16:29:17 UTC
Xamarin.iOS
Version: 15.12.0.2 (Visual Studio Enterprise)
Hash: 87f98a75e
Branch: d17-3
Build date: 2022-07-25 20:18:55-0400
Build Information
Release ID: 1704000715
Git revision: 09071dadfc1b81e4f0e2c9505cd8a5ef0b41d312
Build date: 2022-08-04 16:26:39+00
Build branch: release-17.4
Build lane: release-17.4
Operating System
Mac OS X 12.5.1
Darwin 21.6.0 Darwin Kernel Version 21.6.0
Wed Aug 10 14:28:23 PDT 2022
root:xnu-8020.141.5~2/RELEASE_ARM64_T6000 arm64

I tested on my actual project (preview version, same as you), and i could replicate your error (in standar version it works) so i made this:
1- Open package manager console
2- dotnet tool install -g Redth.Net.Maui.Check
3- maui-check
4- Check my version (if it's the last one)
And now My entry clear button is Working:
<Entry ClearButtonVisibility="WhileEditing"
BackgroundColor="AliceBlue"
Placeholder="Random Text"/>
Try that please! Package Reference

Related

OmniSharp formatter does not format C# files

The installed ms-dotnettools.csharp (v1.25.0) extension does not seem to format the C# code : my C# files witch I try to format popups me about missing C# formatter
Visual Studio Code
There is no formatter for 'csharp' files installed.
[Cancel] [Install Formatter...]
I open in the VSCode the entire root folder, containing several projects (C#, Angular etc.), and when opening individual Cs files and try to Shift+Alf+F to format the file, it asks me for the formatter.
I have the following VSCode configuration
Visual Studio Code
Version: 1.67.2 (user setup)
Commit: c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5
Date: 2022-05-17T18:15:52.058Z (2 wks ago)
Electron: 17.4.1
Chromium: 98.0.4758.141
Node.js: 16.13.0
V8: 9.8.177.13-electron.0
OS: Windows_NT x64 10.0.19044
also this .net installs
.NET SDK (reflecting any global.json):
Version: 5.0.408
Commit: da985e2a23
Runtime Environment:
OS Name: Windows
OS Version: 10.0.19044
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\5.0.408\
Host (useful for support):
Version: 5.0.17
Commit: 6a98414363
.NET SDKs installed:
3.1.419 [C:\Program Files\dotnet\sdk]
5.0.407 [C:\Program Files\dotnet\sdk]
5.0.408 [C:\Program Files\dotnet\sdk]
I've checked that, reset it and restarted VSCode, but it has any effect:
You need to either update .Net to 6+ or install a previous version of Omnisharp.
Version 1.25.0 requires .Net 6+. If that's not an option for your environment then you can install a previous version of the Omnisharp extension.
In order to do this, press ctrl/cmd + shift + x to bring the extensions side panel, then click on the configurations wheel and select 'Install another version'.
I tried 1.23.12 and the formatter is working now.
If you run into this issue again you can check the output of the extension to check what could be causing it.
I'm not sure if you found it already, but I'll leave it here in case someone else needs it.

VSCode (or anothers editors) don't recognize sdk dotnet installed with asdf

I have the dotnet installed in my machine with asdf, and even the asdf use the dotnet-install.sh (this is in code of install of dotnet), the DOTNET_ROOT work with the . ~/.asdf/plugins/dotnet-core/set-dotnet-home.zsh set (tested with echo in terminal), and the dotnet work and find the sdk (dotnet --info):
.NET SDK (reflecting any global.json):
Version: 5.0.300
Commit: 2e0c8c940e
Runtime Environment:
OS Name: arch
OS Version:
OS Platform: Linux
RID: arch-x64
Base Path: /home/caneladeouro/.asdf/installs/dotnet-core/5.0.300/sdk/5.0.300/
Host (useful for support):
Version: 5.0.6
Commit: 478b2f8c0e
.NET SDKs installed:
5.0.300 [/home/caneladeouro/.asdf/installs/dotnet-core/5.0.300/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 5.0.6 [/home/caneladeouro/.asdf/installs/dotnet-core/5.0.300/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 5.0.6 [/home/caneladeouro/.asdf/installs/dotnet-core/5.0.300/shared/Microsoft.NETCore.App]
The Visual Studio Code don't recognized the Sdk of dotnet in folder saying that don't have any .NET Sdk:
It was not possible to find any installed .NET SDKs.
Install a .NET SDK from:
https://aka.ms/dotnet-download
The C# VSCode Extension try to find the default dotnet instalation path and don't find, in this case you need to point manually the path to sdk with some environment variables in .NET Documentation. You must define all these variables below in terminal script initialization (such bashrc, zshrc) and show the path to asdf .NET Sdk installation , but can be used to another location, just change the path:
export DOTNET_MSBUILD_SDK_RESOLVER_SDKS_DIR=$(echo $HOME/.asdf/installs/dotnet-core/5.0.300/sdk/*/Sdks)
export DOTNET_MSBUILD_SDK_RESOLVER_SDKS_VER=5.0.300
export DOTNET_MSBUILD_SDK_RESOLVER_CLI_DIR=$(echo $HOME/.asdf/installs/dotnet-core/5.0.300)
And yes the Sdk folder is inside the Sdk folder, I confuse too (This take more time to resolve).

(AndroidX) Unable to build "AMM0000" - Xamarin.AndroidX.AppCompat.Resources

When building a Xamarin Android project we sporadically get these exceptions. Any ideas how to remove the flakiness? looks like an Xamarin Android bug?
Steps to Reproduce
Install Xamarin.AndroidX.AppCompat.Resources
Build
See warnings
Expected Behavior
No errors
Actual Behavior
Environment
=== Visual Studio Community 2019 for Mac ===
Version 8.7.8 (build 4)
Installation UUID: 6c568fc0-cf38-440a-8b1a-594e0e92e9ac
GTK+ 2.24.23 (Raleigh theme)
Xamarin.Mac 6.18.0.23 (d16-6 / 088c73638)
Package version: 612000093
=== Mono Framework MDK ===
Runtime:
Mono 6.12.0.93 (2020-02/620cf538206) (64-bit)
Package version: 612000093
=== Roslyn (Language Service) ===
3.7.0-6.20427.1+18ede13943b0bfae1b44ef078b2f3923159bcd32
=== NuGet ===
Version: 5.7.0.6702
=== .NET Core SDK ===
SDK: /usr/local/share/dotnet/sdk/3.1.402/Sdks
SDK Versions:
3.1.402
3.1.302
3.1.200
3.1.102
3.1.101
3.1.100
3.0.100
2.1.504
2.1.302
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/msbuild/Current/bin/Sdks
=== .NET Core Runtime ===
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
3.1.8
3.1.6
3.1.2
3.1.1
3.1.0
3.0.0
2.1.22
2.1.20
2.1.17
2.1.15
2.1.14
2.1.13
2.1.8
2.1.2
=== Xamarin.Profiler ===
Version: 1.6.12.29
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler
=== Updater ===
Version: 11
=== Apple Developer Tools ===
Xcode 12.0.1 (17220)
Build 12A7300
=== Xamarin.Mac ===
Xamarin.Mac not installed. Can't find /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/Version.
=== Xamarin.Android ===
Version: 11.0.2.0 (Visual Studio Community)
Commit: xamarin-android/d16-7/025fde9
Android SDK: /Users/curauser/Library/Android/sdk
Supported Android versions:
4.4 (API level 19)
5.0 (API level 21)
6.0 (API level 23)
8.0 (API level 26)
8.1 (API level 27)
SDK Tools Version: 26.1.1
SDK Platform Tools Version: 29.0.6
SDK Build Tools Version: 28.0.3
Build Information:
Mono: 83105ba
Java.Interop: xamarin/java.interop/d16-7#1f3388a
ProGuard: Guardsquare/proguard/proguard6.2.2#ebe9000
SQLite: xamarin/sqlite/3.32.1#1a3276b
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-7#017078f
=== Microsoft OpenJDK for Mobile ===
Java SDK: /Users/curauser/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_1.8.0.25
1.8.0-25
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL
=== Android SDK Manager ===
Version: 16.7.0.13
Hash: 8380518
Branch: remotes/origin/d16-7~2
Build date: 2020-09-16 05:12:24 UTC
=== Android Device Manager ===
Version: 16.7.0.24
Hash: bb090a3
Branch: remotes/origin/d16-7
Build date: 2020-09-16 05:12:46 UTC
=== Xamarin Designer ===
Version: 16.7.0.495
Hash: 03d50a221
Branch: remotes/origin/d16-7-vsmac
Build date: 2020-08-28 13:12:52 UTC
=== Xamarin.iOS ===
Version: 14.0.0.0 (Visual Studio Community)
Hash: 7ec3751a1
Branch: xcode12
Build date: 2020-09-16 11:33:15-0400
=== Build Information ===
Release ID: 807080004
Git revision: 9ea7bef96d65cdc3f4288014a799026ccb1993bc
Build date: 2020-09-16 17:22:54-04
Build branch: release-8.7
Xamarin extensions: 9ea7bef96d65cdc3f4288014a799026ccb1993bc
=== Operating System ===
Mac OS X 10.15.6
Darwin 19.6.0 Darwin Kernel Version 19.6.0
Thu Jun 18 20:49:00 PDT 2020
root:xnu-6153.141.1~1/RELEASE_X86_64 x86_64
Build Logs
https://gist.github.com/moerabaya/c1cc8fdbb124c17028f82e11adf7595f
Example Project (If Possible)
Packages
1-
2-
3-

IndicatorView is only showing one indicator circle, after upgrading to Xcode 12 (Visual Studio Mac - Xamarin)

I have a carouselview, for showing pictures.
And an Indicatorview, attached to it.
The IndicatorView is only showing one indicator circle, besides more itens should be shown.
If I set a background color, I can see that the parent view is occupying the correct space.
When I slide between pictures, I can see a small animation, but still only one circle at a time.
I've upgraded Xcode to version 12, and my Visual Studio for Mac is with the latest stable version.
The only change I've made, was downloading xamarin.ios-14.0.0.0.pkg, because, without it, it wouldn't start the app on the phone.
My iPhone is with the final iOS 14.
On the App Store, my App wasn't updated.
So, on my phone, with iOS 14, the indicator view works fine.
The problem only happens on the new debugged version.
<Grid
BackgroundColor="Black">
<CarouselView
x:Name="carousel"
IndicatorView="indicatorView">
<CarouselView.ItemTemplate>
<DataTemplate>
<Grid
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand">
<Grid.GestureRecognizers>
<TapGestureRecognizer
Command="{Binding TapCommand}"
NumberOfTapsRequired="1">
</TapGestureRecognizer>
</Grid.GestureRecognizers>
<ffimageloading:CachedImage
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"
LoadingPlaceholder="loading.gif"
Aspect="AspectFill"
BackgroundColor="Black"
Source="{Binding Url}">
</ffimageloading:CachedImage>
</Grid>
</DataTemplate>
</CarouselView.ItemTemplate>
</CarouselView>
<IndicatorView
x:Name="indicatorView"
VerticalOptions="End"
HorizontalOptions="Center"
IndicatorsShape="Circle"
IndicatorSize="8"
IndicatorColor="White"
Margin="0,0,0,15"
SelectedIndicatorColor="LightGray" />
</Grid>
=== Visual Studio Community 2019 for Mac ===
Version 8.7.7 (build 10)
Installation UUID: aa1a670b-2ee7-474a-b67d-f22b879e6add
GTK+ 2.24.23 (Raleigh theme)
Xamarin.Mac 6.18.0.23 (d16-6 / 088c73638)
Package version: 612000093
=== Mono Framework MDK ===
Runtime:
Mono 6.12.0.93 (2020-02/620cf538206) (64-bit)
Package version: 612000093
=== Roslyn (Language Service) ===
3.7.0-6.20427.1+18ede13943b0bfae1b44ef078b2f3923159bcd32
=== NuGet ===
Version: 5.7.0.6702
=== .NET Core SDK ===
SDK: /usr/local/share/dotnet/sdk/3.1.402/Sdks
SDK Versions:
3.1.402
3.1.401
3.1.302
3.1.301
3.1.300
3.1.200
3.1.102
3.1.101
3.1.100
3.0.101
3.0.100
3.0.100-rc1-014190
3.0.100-preview9-014004
3.0.100-preview8-013656
2.1.701
2.1.505
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/msbuild/Current/bin/Sdks
=== .NET Core Runtime ===
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
3.1.8
3.1.7
3.1.6
3.1.5
3.1.4
3.1.2
3.1.1
3.1.0
3.0.1
3.0.0
3.0.0-rc1-19456-20
3.0.0-preview9-19423-09
2.1.22
2.1.21
2.1.20
2.1.19
2.1.18
2.1.17
2.1.16
2.1.15
2.1.14
2.1.13
2.1.12
2.1.9
=== Xamarin.Profiler ===
Version: 1.6.12.26
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler
=== Updater ===
Version: 11
=== Apple Developer Tools ===
Xcode 12.0 (17219)
Build 12A7209
=== Xamarin.Mac ===
Version: 6.20.2.2 (Visual Studio Community)
Hash: 817b6f72a
Branch: d16-7
Build date: 2020-07-18 18:44:59-0400
=== Xamarin.iOS ===
Version: 14.0.0.0 (Visual Studio Community)
Hash: 7ec3751a1
Branch: xcode12
Build date: 2020-09-16 11:33:15-0400
=== Xamarin Designer ===
Version: 16.7.0.495
Hash: 03d50a221
Branch: remotes/origin/d16-7-vsmac
Build date: 2020-08-28 13:12:52 UTC
=== Xamarin.Android ===
Version: 11.0.2.0 (Visual Studio Community)
Commit: xamarin-android/d16-7/025fde9
Android SDK: /Users/rafaelrasche/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
7.0 (API level 24)
8.0 (API level 26)
8.1 (API level 27)
SDK Tools Version: 26.1.1
SDK Platform Tools Version: 29.0.4
SDK Build Tools Version: 28.0.3
Build Information:
Mono: 83105ba
Java.Interop: xamarin/java.interop/d16-7#1f3388a
ProGuard: Guardsquare/proguard/proguard6.2.2#ebe9000
SQLite: xamarin/sqlite/3.32.1#1a3276b
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-7#017078f
=== Microsoft OpenJDK for Mobile ===
Java SDK: /Users/rafaelrasche/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_1.8.0.25
1.8.0-25
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL
=== Android SDK Manager ===
Version: 16.7.0.13
Hash: 8380518
Branch: remotes/origin/d16-7~2
Build date: 2020-08-19 22:18:28 UTC
=== Android Device Manager ===
Version: 16.7.0.24
Hash: bb090a3
Branch: remotes/origin/d16-7
Build date: 2020-08-19 22:18:52 UTC
=== Build Information ===
Release ID: 807070010
Git revision: e58142243407a357198d18ee1a37b1e67a702eff
Build date: 2020-09-10 11:48:02-04
Build branch: release-8.7
Xamarin extensions: e58142243407a357198d18ee1a37b1e67a702eff
=== Operating System ===
Mac OS X 10.15.6
Darwin 19.6.0 Darwin Kernel Version 19.6.0
Thu Jun 18 20:49:00 PDT 2020
root:xnu-6153.141.1~1/RELEASE_X86_64 x86_64
The IndicatorView is inside a grid, and HorizontalOptions="Center".
I've just found out that that's the actual problem.
If you change it to HorizontalOptions="FillAndExpand", all circles are back.
When you keep this setting as "Center", depending of the number of itens, it could show 1/3 of the circles. I couldn't find the exact formula.
But everything is ok now.
Welcome to SO!
The IndicatorView is only showing one indicator circle, besides more itens should be shown.
From shaed code, I can not seeing where set the x:Name="indicatorView" for CarouselView.
You can modify code as follows:
<CarouselView IndicatorView="indicatorView"> // set indicatorView for CarouselView
<CarouselView.ItemTemplate>
<DataTemplate>
...
</DataTemplate>
</CarouselView.ItemTemplate>
</CarouselView>
<IndicatorView
x:Name="indicatorView"
IsVisible="{Binding CarouselVisible}"
VerticalOptions="End"
IndicatorsShape="Circle"
IndicatorSize="8"
IndicatorColor="#666666"
Margin="0,0,0,7"
SelectedIndicatorColor="#cccccc"
HorizontalOptions="Center"
/>

Error "Xamarin.Android.Support.Design 27.0.2.1 is not compatible with monoandroid60"

I am trying to make an app on Visual Studio for my Android phone which runs Android 6.0 Marshmallow.
I compiled the project into an APK file succesfully but my phone failed to parse it so I looked here ( xamarin Visual Studio 2015 apk fails to install: Error "parsing the package" ) and changed my compiler target from Android 8.1 to Android 6.0. I also disabled Shared Mono Runtime.
Visual Studio said I needed to close and then re-open the project for the change so I did it and opening it I got this error:
Severity Code Description Project File Line Suppression State
Error NU1202 Package Xamarin.Android.Support.Design 27.0.2.1 is not compatible with monoandroid60 (MonoAndroid,Version=v6.0). Package Xamarin.Android.Support.Design 27.0.2.1 supports: monoandroid81 (MonoAndroid,Version=v8.1) App1 d:\Xamarin\App1\App1\App1.csproj 1
so I opened NuGet Package Manager and changed the Xamarin.Android.Support.Design package version from 27.0 to 23.0. The error went away but the app preview failed to render and I could only see a black screen with a warning "This project contains resources that were not compiled successfully" but there are no actual warnings in the Error List. How do I fix all this?
Edit: The package built after changing the Xamarin.Android.Support.Design version to 23 is unable to be parsed as well
this is my VS information
Microsoft Visual Studio Community 2017
Version 15.8.5
VisualStudio.15.Release/15.8.5+28010.2036
Microsoft .NET Framework
Version 4.7.03062
Installed Version: Community
C# Tools 2.9.0-beta8-63208-01
Common Azure Tools 1.10
Extensibility Message Bus 1.1.49 (remotes/origin/d15-8#ee674f3)
Microsoft JVM Debugger 1.0
Microsoft MI-Based Debugger 1.0
Mono Debugging for Visual Studio 4.11.11-pre (8fb558f)
NuGet Package Manager 4.6.0
ProjectServicesPackage Extension 1.0
ResourcePackage Extension 1.0
ResourcePackage Extension 1.0
Visual Basic Tools 2.9.0-beta8-63208-01
Visual F# Tools 10.2 for F# 4.5 15.8.0.0. Commit Hash: Visual Studio Code Debug Adapter Host Package 1.0Xamarin 4.11.0.776 (d15-8#1ae9b59d7)
Xamarin Designer 4.15.9 (d000f568b)
Xamarin Templates 1.1.116 (9619170)
Xamarin.Android SDK 9.0.0.19 (HEAD/a8a3b0ec7)
Xamarin.Android Reference Assemblies and MSBuild support.
I figured it out. The solution is to change the Xamarin.Android.Support.Design package to 23.0 and change your AndroidManifest.Xml and other code to remove attributes/implementations of classes which are not in your targeted platform API level range (in my case, Android 6.0 API level 23 - Android 5.0 API level 21). See: https://developer.android.com/reference/
https://learn.microsoft.com/en-us/xamarin/android/app-fundamentals/android-api-levels
In order to fix the package parsing error you need to sign your app through the Visual Studio distribution wizard. See: https://learn.microsoft.com/en-us/xamarin/android/deploy-test/signing/?tabs=vswin
I hope this helps someone else.

Categories