Skip to content
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

[IOS16] CommandBar title shortened to one letter + ... instead of full title. #10207

Open
Marc-Antoine-Soucy opened this issue Oct 20, 2022 · 10 comments
Labels
area/commandbar Categorizes an issue or PR as relevant to CommandBar difficulty/medium 🤔 Categorizes an issue for which the difficulty level is reachable with a good understanding of WinUI kind/bug Something isn't working platform/ios 🍎 Categorizes an issue or PR as relevant to the iOS platform project/text 🔤 Categorizes an issue or PR as relevant to text (TextBox, PasswordBox, TextBlock, Fonts, …)

Comments

@Marc-Antoine-Soucy
Copy link

Marc-Antoine-Soucy commented Oct 20, 2022

Current behavior

On IOS 16, on pages where there is a (single) in the commandbar, the title is shortened to one letter + ...

example: Orders being shortened to O...
image

Expected behavior

I would expect the title to be fully shown, just like on previous IOS versions.

How to reproduce it (as minimally and precisely as possible)

IOSNavBarTitle16.zip

			<CommandBar.Content>
				<Grid VerticalAlignment="Center"
					  ios:HorizontalAlignment="Center">

					<!-- CommandBar Title-->
					<TextBlock Text="PageTitle"
							   Style="{StaticResource SomeStyle}"
							   Foreground="{StaticResource TextColor}"
							   ios:TextAlignment="Center" />
				</Grid>
			</CommandBar.Content>

			<CommandBar.PrimaryCommands>

				<!-- Search Button -->
				<AppBarButton Command="{Binding Dosomething}">
					<AppBarButton.Icon>
						<BitmapIcon UriSource="{StaticResource Icon}"
									Foreground="{StaticResource IconColor}" />
					</AppBarButton.Icon>
				</AppBarButton>
			</CommandBar.PrimaryCommands>
		</CommandBar>

In a certain app, which uses NativeDefaultCommandBar, any page with a commandbar like this one has this issue with IOS 16. I am working right now on making a sample

Workaround

So far, I found 2:

1: If you put <AppBarButton/> (just like that, empty), above the real AppBarButton with an icon, it gives more space to the title.
If you do it several times, it gives enough space for the whole title to show. I do not understand why it works.

2: You can also set the grid, which contains the title, to horizontalAlignment=Stretch, and then add some margin to manually center the title.

Works on UWP/WinUI

Yes

Environment

Uno.UI / Uno.UI.WebAssembly / Uno.UI.Skia

NuGet package version(s)

<PackageReference Include="Microsoft.UI.Xaml" Version="2.6.0-prerelease.210623001" /> <PackageReference Include="Serilog.Sinks.Xamarin" Version="0.1.37" /> <PackageReference Include="System.Memory" Version="4.5.4" /> <PackageReference Include="Uno.Microsoft.Toolkit.Uwp.DeveloperTools" Version="7.1.10" /> <PackageReference Include="Uno.Microsoft.Toolkit.Uwp.UI.Controls" Version="7.1.10" /> <PackageReference Include="Uno.Microsoft.Xaml.Behaviors.Uwp.Managed" Version="2.3.0-uno.12" /> <PackageReference Include="Uno.UI.Adapter.Microsoft.Extensions.Logging" Version="4.5.14" /> <PackageReference Include="Uno.UI.RemoteControl" Version="4.5.14" /> <PackageReference Include="Uno.XamlMerge.Task">

<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="6.0.0" /> <PackageReference Include="Uno.CodeGen" Version="2.0.0-dev.10" /> <PackageReference Include="Uno.Injectable" Version="2.0.0-dev.10" /> <PackageReference Include="Uno.Material" Version="2.0.0-dev.179" /> <PackageReference Include="Uno.SourceGenerationTasks" Version="4.1.0" /> <PackageReference Include="Uno.Toolkit.UI" Version="1.3.0-dev.11" /> <PackageReference Include="Uno.Toolkit.UI.Material" Version="1.3.0-dev.11" /> <PackageReference Include="Uno.UI" Version="4.5.14" /> <PackageReference Include="Xamarin.Essentials.Interfaces" Version="1.7.3.1" />

Affected platforms

iOS

IDE

Visual Studio 2022

IDE version

17.3.6

Relevant plugins

No response

Anything else we need to know?

I am working on making a sample.

@Marc-Antoine-Soucy Marc-Antoine-Soucy added kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. labels Oct 20, 2022
@Marc-Antoine-Soucy
Copy link
Author

I tried building the app on the latest pre-release, but I would get this error: 1> MSBUILD : error : Generation failed: System.AggregateException: One or more errors occurred. ---> System.InvalidOperationException: Generation failed for Uno.UI.SourceGenerators.XamlGenerator.XamlCodeGenerator. System.NullReferenceException: Object reference not set to an instance of an object.
1>MSBUILD : error : at Uno.Roslyn.GeneratorExecutionContextExtensions.GetMSBuildItemsWithAdditionalFiles(GeneratorExecutionContext context, String name) in /home/vsts/work/1/s/src/SourceGenerators/SourceGeneratorHelpers/Helpers/GeneratorExecutionContextExtensions.cs:line 37
1>MSBUILD : error : at Uno.UI.SourceGenerators.XamlGenerator.XamlCodeGeneration.GetWinUIItems(String name) in /home/vsts/work/1/s/src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlCodeGeneration.cs:line 222
1>MSBUILD : error : at Uno.UI.SourceGenerators.XamlGenerator.XamlCodeGeneration..ctor(GeneratorExecutionContext context) in /home/vsts/work/1/s/src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlCodeGeneration.cs:line 125
1>MSBUILD : error : at Uno.UI.SourceGenerators.XamlGenerator.XamlCodeGenerator.Execute(GeneratorExecutionContext context) in /home/vsts/work/1/s/src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlCodeGenerator.cs:line 52
1>MSBUILD : error : at Uno.SourceGeneration.Host.SourceGeneratorEngine.<>c__DisplayClass4_1.b__13(ValueTuple3 generatorDef) in D:\a\1\s\src\Uno.SourceGeneration.Engine.Shared\SourceGeneratorEngine.cs:line 224 1>MSBUILD : error : at Uno.SourceGeneration.Host.SourceGeneratorEngine.<>c__DisplayClass4_1.<Generate>b__13(ValueTuple3 generatorDef) in D:\a\1\s\src\Uno.SourceGeneration.Engine.Shared\SourceGeneratorEngine.cs:line 243
1>MSBUILD : error : at System.Linq.Parallel.SelectQueryOperator2.SelectQueryOperatorEnumerator1.MoveNext(TOutput& currentElement, TKey& currentKey)
1>MSBUILD : error : at System.Linq.Parallel.StopAndGoSpoolingTask2.SpoolingWork() 1>MSBUILD : error : at System.Linq.Parallel.SpoolingTaskBase.Work() 1>MSBUILD : error : at System.Linq.Parallel.QueryTask.BaseWork(Object unused) 1>MSBUILD : error : at System.Threading.Tasks.Task.Execute() 1>MSBUILD : error : --- End of inner exception stack trace --- 1>MSBUILD : error : 1>MSBUILD : error : Server stack trace: 1>MSBUILD : error : at System.Linq.Parallel.QueryTaskGroupState.QueryEnd(Boolean userInitiatedDispose) 1>MSBUILD : error : at System.Linq.Parallel.DefaultMergeHelper2.System.Linq.Parallel.IMergeHelper.Execute()
1>MSBUILD : error : at System.Linq.Parallel.MergeExecutor1.Execute[TKey](PartitionedStream2 partitions, Boolean ignoreOutput, ParallelMergeOptions options, TaskScheduler taskScheduler, Boolean isOrdered, CancellationState cancellationState, Int32 queryId)
1>MSBUILD : error : at System.Linq.Parallel.PartitionedStreamMerger1.Receive[TKey](PartitionedStream2 partitionedStream)
1>MSBUILD : error : at System.Linq.Parallel.UnaryQueryOperator2.UnaryQueryOperatorResults.ChildResultsRecipient.Receive[TKey](PartitionedStream2 inputStream)
1>MSBUILD : error : at System.Linq.Parallel.ScanQueryOperator1.ScanEnumerableQueryOperatorResults.GivePartitionedStream(IPartitionedStreamRecipient1 recipient)
1>MSBUILD : error : at System.Linq.Parallel.UnaryQueryOperator2.UnaryQueryOperatorResults.GivePartitionedStream(IPartitionedStreamRecipient1 recipient)
1>MSBUILD : error : at System.Linq.Parallel.QueryOperator1.ExecuteAndGetResultsAsArray() 1>MSBUILD : error : at Uno.SourceGeneration.Host.SourceGeneratorEngine.Generate() in D:\a\1\s\src\Uno.SourceGeneration.Engine.Shared\SourceGeneratorEngine.cs:line 166 1>MSBUILD : error : at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs) 1>MSBUILD : error : at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg) 1>MSBUILD : error : 1>MSBUILD : error : Exception rethrown at [0]: 1>MSBUILD : error : at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) 1>MSBUILD : error : at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) 1>MSBUILD : error : at Uno.SourceGeneratorTasks.RemoteSourceGeneratorEngine.Generate(RemotableLogger2 logger, BuildEnvironment environment) 1>MSBUILD : error : at Uno.SourceGeneration.Host.Server.GenerationServerHost.GenerateForCollection(EnvironmentPool collection, BuildEnvironment environment) in D:\a\1\s\src\Uno.SourceGeneration.Host\Server\GenerationServerHost.netframework.cs:line 61 1>MSBUILD : error : at Uno.SourceGeneration.Host.Server.GenerationServerHost.RunGeneration(RunRequest request, CancellationToken cancellationToken) in D:\a\1\s\src\Uno.SourceGeneration.Host\Server\GenerationServerHost.cs:line 73 1>MSBUILD : error : ---> (Inner Exception #0) System.InvalidOperationException: Generation failed for Uno.UI.SourceGenerators.XamlGenerator.XamlCodeGenerator. System.NullReferenceException: Object reference not set to an instance of an object. 1>MSBUILD : error : at Uno.Roslyn.GeneratorExecutionContextExtensions.GetMSBuildItemsWithAdditionalFiles(GeneratorExecutionContext context, String name) in /home/vsts/work/1/s/src/SourceGenerators/SourceGeneratorHelpers/Helpers/GeneratorExecutionContextExtensions.cs:line 37 1>MSBUILD : error : at Uno.UI.SourceGenerators.XamlGenerator.XamlCodeGeneration.GetWinUIItems(String name) in /home/vsts/work/1/s/src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlCodeGeneration.cs:line 222 1>MSBUILD : error : at Uno.UI.SourceGenerators.XamlGenerator.XamlCodeGeneration..ctor(GeneratorExecutionContext context) in /home/vsts/work/1/s/src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlCodeGeneration.cs:line 125 1>MSBUILD : error : at Uno.UI.SourceGenerators.XamlGenerator.XamlCodeGenerator.Execute(GeneratorExecutionContext context) in /home/vsts/work/1/s/src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlCodeGenerator.cs:line 52 1>MSBUILD : error : at Uno.SourceGeneration.Host.SourceGeneratorEngine.<>c__DisplayClass4_1.<Generate>b__13(ValueTuple3 generatorDef) in D:\a\1\s\src\Uno.SourceGeneration.Engine.Shared\SourceGeneratorEngine.cs:line 224
1>MSBUILD : error : at Uno.SourceGeneration.Host.SourceGeneratorEngine.<>c__DisplayClass4_1.b__13(ValueTuple3 generatorDef) in D:\a\1\s\src\Uno.SourceGeneration.Engine.Shared\SourceGeneratorEngine.cs:line 243 1>MSBUILD : error : at System.Linq.Parallel.SelectQueryOperator2.SelectQueryOperatorEnumerator1.MoveNext(TOutput& currentElement, TKey& currentKey) 1>MSBUILD : error : at System.Linq.Parallel.StopAndGoSpoolingTask2.SpoolingWork()
1>MSBUILD : error : at System.Linq.Parallel.SpoolingTaskBase.Work()
1>MSBUILD : error : at System.Linq.Parallel.QueryTask.BaseWork(Object unused)
1>MSBUILD : error : at System.Threading.Tasks.Task.Execute()<---
1>MSBUILD : error :
1>MSBUILD : error : ---> (Inner Exception #1) System.InvalidOperationException: Generation failed for Uno.UI.SourceGenerators.RemoteControl.RemoteControlGenerator. System.NullReferenceException: Object reference not set to an instance of an object.
1>MSBUILD : error : at Uno.Roslyn.GeneratorExecutionContextExtensions.GetMSBuildItemsWithAdditionalFiles(GeneratorExecutionContext context, String name) in /home/vsts/work/1/s/src/SourceGenerators/SourceGeneratorHelpers/Helpers/GeneratorExecutionContextExtensions.cs:line 37
1>MSBUILD : error : at Uno.UI.SourceGenerators.RemoteControl.RemoteControlGenerator.<>c__DisplayClass4_0.g__BuildSearchPath|0(String s) in /home/vsts/work/1/s/src/SourceGenerators/Uno.UI.SourceGenerators/RemoteControl/RemoteControlGenerator.cs:line 81
1>MSBUILD : error : at System.Linq.Enumerable.d__172.MoveNext() 1>MSBUILD : error : at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext()
1>MSBUILD : error : at System.Linq.Enumerable.d__641.MoveNext() 1>MSBUILD : error : at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext()
1>MSBUILD : error : at System.String.Join(String separator, IEnumerable1 values) 1>MSBUILD : error : at Uno.UI.SourceGenerators.RemoteControl.RemoteControlGenerator.BuildSearchPaths(GeneratorExecutionContext context, IndentedStringBuilder sb) in /home/vsts/work/1/s/src/SourceGenerators/Uno.UI.SourceGenerators/RemoteControl/RemoteControlGenerator.cs:line 88 1>MSBUILD : error : at Uno.UI.SourceGenerators.RemoteControl.RemoteControlGenerator.Execute(GeneratorExecutionContext context) in /home/vsts/work/1/s/src/SourceGenerators/Uno.UI.SourceGenerators/RemoteControl/RemoteControlGenerator.cs:line 51 1>MSBUILD : error : at Uno.SourceGeneration.Host.SourceGeneratorEngine.<>c__DisplayClass4_1.<Generate>b__13(ValueTuple3 generatorDef) in D:\a\1\s\src\Uno.SourceGeneration.Engine.Shared\SourceGeneratorEngine.cs:line 224
1>MSBUILD : error : at Uno.SourceGeneration.Host.SourceGeneratorEngine.<>c__DisplayClass4_1.b__13(ValueTuple3 generatorDef) in D:\a\1\s\src\Uno.SourceGeneration.Engine.Shared\SourceGeneratorEngine.cs:line 243 1>MSBUILD : error : at System.Linq.Parallel.SelectQueryOperator2.SelectQueryOperatorEnumerator1.MoveNext(TOutput& currentElement, TKey& currentKey) 1>MSBUILD : error : at System.Linq.Parallel.StopAndGoSpoolingTask2.SpoolingWork()
1>MSBUILD : error : at System.Linq.Parallel.SpoolingTaskBase.Work()
1>MSBUILD : error : at System.Linq.Parallel.QueryTask.BaseWork(Object unused)
1>MSBUILD : error : at System.Threading.Tasks.Task.Execute()<---
1>MSBUILD : error :
1> C:\Users\ma.soucy.nuget\packages\uno.sourcegenerationtasks\4.1.0\build\netstandard1.0\Uno.SourceGenerationTasks.targets(134,2): error : Generation failed, error code Rejected

@jeromelaban
Copy link
Member

For the latest pre-release you'll need to the latest uno-sourcegeneration tasks as well. Is the package installed explicitly in your app ?

@jeromelaban jeromelaban added platform/ios 🍎 Categorizes an issue or PR as relevant to the iOS platform and removed triage/untriaged Indicates an issue requires triaging or verification labels Oct 20, 2022
@Marc-Antoine-Soucy
Copy link
Author

Apparently, yes. I will update it

@jeromelaban
Copy link
Member

Also, can you try with iOS 16.1? I recall there was an issue with UINavigation and iOS 16, but I can't find the link anymore.

@Marc-Antoine-Soucy
Copy link
Author

Marc-Antoine-Soucy commented Oct 20, 2022

I don't have access to an IOS 16.1 device/simulator. Is it easy to install one?

@Marc-Antoine-Soucy
Copy link
Author

Marc-Antoine-Soucy commented Oct 20, 2022

now, even thought I get another error message when I try to build on the simulator
1> C:\Users\ma.soucy.nuget\packages\uno.ui\4.6.0-dev.772\buildTransitive\xamarinios10\uno.winui.common.targets(212,3): error : Building for the iOS Simulator requires the use of the static registrar. Make sure that MtouchExtraArgs contains --registrar:static. See #9430 for more details.

even thought I put
image
I'm trying to put it elsewhere in the page, or with a = instead of : but nothing seems to work.

@jeromelaban
Copy link
Member

Can you tell what does not work? Are there errors ? Also, it's likely that you already have an MtouchExtraArgs entry in the file below.

@Marc-Antoine-Soucy
Copy link
Author

Marc-Antoine-Soucy commented Oct 20, 2022

Yeah, you are correct, there was another MtouchExtraArgs entry below that. When I built it after that, it remained stuck in the splashscreen. So, I closed the app and reopened it and it closed itself almost instantly. I'm not sure if that's the navigation bug you were referring to?

Actually, it was an exception I somehow missed, and the problem was the mergedDictionnary was not created when building the app.

Now, I am building it again because I forgot to check the build/debugging logs. It might take a bit of time because it takes a while to build.

@Marc-Antoine-Soucy
Copy link
Author

So, I can confirm this bug also happens on the latest pre-release 4.6.0-dev.772

@Marc-Antoine-Soucy
Copy link
Author

IOSNavBarTitle16.zip
added a sample app

There's no ... in the title, but the root problem, which is that there's not enough space for a reasonable title to display is still very obviously there.

@MartinZikmund MartinZikmund changed the title [IOS16] Commandbar title shortened to one letter + ... instead of full title. [IOS16] CommandBar title shortened to one letter + ... instead of full title. Aug 16, 2023
@MartinZikmund MartinZikmund added difficulty/medium 🤔 Categorizes an issue for which the difficulty level is reachable with a good understanding of WinUI area/commandbar Categorizes an issue or PR as relevant to CommandBar project/text 🔤 Categorizes an issue or PR as relevant to text (TextBox, PasswordBox, TextBlock, Fonts, …) and removed difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. labels Aug 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/commandbar Categorizes an issue or PR as relevant to CommandBar difficulty/medium 🤔 Categorizes an issue for which the difficulty level is reachable with a good understanding of WinUI kind/bug Something isn't working platform/ios 🍎 Categorizes an issue or PR as relevant to the iOS platform project/text 🔤 Categorizes an issue or PR as relevant to text (TextBox, PasswordBox, TextBlock, Fonts, …)
Projects
None yet
Development

No branches or pull requests

3 participants