Closed JoacimWall closed 2 years ago
@pictos thoughts?
@jfversluis looks like that's duplicated from #761 I'll give some love on this tomorrow
@JoacimWall I could not run your sample on my machine, I tried to create a repro and I coudn't reproduce the error. Can you send another repo, if you can generate one without any thirdparty software would be great! @AlleSchonWeg can you provide a repo as well
@JoacimWall I could not run your sample on my machine, I tried to create a repro and I coudn't reproduce the error. Can you send another repo, if you can generate one without any thirdparty software would be great! @AlleSchonWeg can you provide a repo as well
Hi @pictos I have only used
<PackageReference Include="Xamarin.Forms" Version="5.0.0.1905" />
<PackageReference Include="Xamarin.Essentials" Version="1.6.0" />
<PackageReference Include="Xamarin.CommunityToolkit" Version="1.0.2" />
that should be ok. The only thing i have changed from the standard xamarin.froms template is that i change target version for Andriod to sdk 30.
regards Joacim
@JoacimWall thanks for your reply, I'll take a look during this week.
@JoacimWall can you try it again with the new XCT package? I tested here with the latest versions of XF and XCT I couldn't reproduce this behavior.
Hello. I got the same problem using the camera view. In debug mode everything works fine. In release mode the app crashes. Setting the linker option from "Link SDKs Only" to "none" solves the problem.
I´m using the latest versions of all Xamarin-Components.
@FM1973 could you use the same linker behavior for debug and share the exception and logs with us? Thanks
Sure... That´s the exception:
[mono] Unhandled Exception:
[mono] System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: EventToCommandBehavior: Couldn't resolve the event.
[mono] Parameter name: EventName
[mono] at Xamarin.Forms.Behavior.Xama03-22 01:29:02.559 E/mono ( 4958): at Xamarin.CommunityToolkit.Behaviors.EventToCommandBehavior.RegisterEvent () [0x00030] in <288835d5dc1b4bf68c236ae1ab65eb41>:0
[mono] at Xamarin.CommunityToolkit.Behaviors.EventToCommandBehavior.OnAttachedTo (Xamarin.Forms.VisualElement bindable) [0x00007] in <288835d5dc1b4bf68c236ae1ab65eb41>:0
[mono] at Xamarin.Forms.Behavior1[T].OnAttachedTo (Xamarin.Forms.BindableObject bindable) [0x00007] in D:\a\1\s\Xamarin.Forms.Core\Interactivity\Behavior.cs:45 [mono] at CbScrumMobile.Views.ReceiptView..ctor () [0x00008] in D:\Kunden\CreativeBITS\CbScrum\CbScrumMobile\CbScrumMobile\CbScrrin.Forms.IAttachedObject.AttachTo (Xamarin.Forms.BindableObject bindable) [0x00027] in D:\a\1\s\Xamarin.Forms.Core\Interactivity\Behavior.cs:22 [mono] at Xamarin.Forms.AttachedCollection
1[T].InsertItem (System.Int32 index, T item) [0x0002b] in D:\a\1\s\Xamarin.Forms.Core\Interactivity\AttachedCollection.cs:61
[mono] at System.Collections.ObjectModel.Collection1[T].Add (T item) [0x00020] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/Common/src/CoreLib/System/Collections/ObjectModel/Collection.cs:71 [mono] at CbScrumMobile.Views.ReceiptView.InitializeComponent () [0x00023] in D:\Kunden\CreativeBITS\CbScrum\CbScrumMobile\CbScrumMobile\CbScrumMobile\obj\Debug etstandard2.1\Views\ReceiptView.xaml.g.cs:26 [mono-rt] at Xamarin.Forms.Behavior.Xamarin.Forms.IAttachedObject.AttachTo (Xamarin.Forms.BindableObject bindable) [0x00027] in D:\a\1\s\Xamarin.Forms.Core\Interactivity\Behavior.cumMobile\Views\ReceiptView.xaml.cs:18 [mono] at (wrapper managed-to-native) System.Reflection.RuntimeConstructorInfo.InternalInvoke(System.Reflection.RuntimeConstructorInfo,object,object[],System.Exception&) [mono] at System.Reflection.RuntimeConstructorInfo.InternalInvoke (System.Object obj, System.Object[] parameters, System.Boolean wrapExceptions) [0x00005] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:936 [mono] --- End of inner exception stack trace --- [mono] at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.82(intptr,intptr,intptr,intptr,intptr) [mono] at (wrapper native-to-managed) Android.Runtime.DynamicMethodNameCounter.82(intptr,intptr,intptr,intptr,intptr) [mono-rt] at (wrapper managed-to-native) System.Reflection.RuntimeConst03-22 01:29:02.560 E/mono-rt ( 4958): [ERROR] FATAL UNHANDLED EXCEPTION: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: EventToCommandBehavior: Couldn't resolve the event. [mono-rt] Parameter name: EventName [mono-rt] at Xamarin.CommunityToolkit.Behaviors.EventToCommandBehavior.RegisterEvent () [0x00030] in <288835d5dc1b4bf68c236ae1ab65eb41>:0 [mono-rt] at Xamarin.CommunityToolkit.Behaviors.EventToCommandBehavior.OnAttachedTo (Xamarin.Forms.VisualElement bindable) [0x00007] in <288835d5dc1b4bf68c236ae1ab65eb41>:0 [mono-rt] at Xamarin.Forms.Behavior
1[T].OnAttachedTo (Xamarin.Forms.BindableObject bindable) [0x00007] in D:\a\1\s\Xamarin.Forms.Core\Interactivity\Behavior.cs:45
[HostConnection] HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDs:22
[mono-rt] at Xamarin.Forms.AttachedCollection1[T].InsertItem (System.Int32 index, T item) [0x0002b] in D:\a\1\s\Xamarin.Forms.Core\Interactivity\AttachedCollection.cs:61 [mono-rt] at System.Collections.ObjectModel.Collection
1[T].Add (T item) [0x00020] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/Common/src/CoreLib/System/Collections/ObjectModel/Collection.cs:71
[mono-rt] at CbScrumMobile.Views.ReceiptView.InitializeComponent () [0x00023] in D:\Kunden\CreativeBITS\CbScrum\CbScrumMobile\CbScrumMobile\CbScrumMobile\obj\Debug
etstandard2.1\Views\ReceiptView.xaml.g.cs:26
[mono-rt] at CbScrumMobile.Views.ReceiptView..ctor () [0x00008] in D:\Kunden\CreativeBITS\CbScrum\CbScrumMobile\CbScrumMobile\CbScrumMobile\Views\ReceiptView.xaml.cs:18
[mono-rt] at (wrapper managed-to-native) System.Reflection.RuntimeConstructorInfo.InternalInvoke(System.Reflection.RuntimeConstructorInfo,object,object[],System.Exception&)
[mono-rt] at System.Reflection.RuntimeConstructorInfo.InternalInvoke (System.Object obj, System.Object[] parameters, System.Boolean wrapExceptions) [0x00005] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:936
[mono-rt] --- End of inner exception stack trace ---
[mono-rt] at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.82(intptr,intptr,intptr,intptr,intptr)
[mono-rt] at (wrapper native-to-managed) Android.Runtime.DynamicMethodNameCounter.82(intptr,intptr,intptr,intptr,intptr)
Hi have now tested this in version 1.1.0 and the bug is still there.
//Regards Joacim
@JoacimWall thanks for the report. We'll look this asap
Any new news?
The behavior in my project is different, the view silently fails to load in Release mode, when the SDKs are linked. The only solution has been to skip linking. However, if there are dependencies like Xamarin.AndroidX.Core.View modules, it becomes a bigger problem. The latest Xamarin.CommunityToolkit pre-release still has the linking problem, but the dependency with AndroidX.Core is absent. I'm skipping linking toolkit in both iOS and Android builds.
I am using the EventToCommandBehavior on a RangeSlider which works perfectly fine in debug. But when I build in release with link behavior "Link Framework SDKs Only" i get the same error as FM1973: EventToCommandBehavior: Couldn't resolve the event. Parameter name: EventName
@michelmoorlag can you share how you are using the behavior?
@pictos I definitly can. This is the code that cause the issue:
<xct:RangeSlider
MinimumValue="{Binding SearchFilterControlSetData.MinDistance}"
MaximumValue="{Binding SearchFilterControlSetData.MaxDistance}"
LowerValue="{Binding SearchFilterControlSetData.LowerDistance}"
UpperValue="{Binding SearchFilterControlSetData.UpperDistance}"
StepValue="5"
TrackSize="10">
<xct:RangeSlider.Behaviors>
<xct:EventToCommandBehavior
EventName="DragCompleted"
Command="{Binding DragCompletedCommand}" />
</xct:RangeSlider.Behaviors>
</xct:RangeSlider>
` where xtc is the the namespace : xmlns:xct="http://xamarin.com/schemas/2020/toolkit"
The command is defined in the viewmodel like:
public ICommand DragCompletedCommand { get; set; }
And initialized like:
DragCompletedCommand = new Command(async () => await GetFilteredAssigmentCount());
I can make a small sample solution If that would help?
@michelmoorlag if you can do a small sample will be awesome!!! Sorry for the late reply
@pictos Here you are:
[EventToCommandBehaviorBug.zip] (https://github.com/xamarin/XamarinCommunityToolkit/files/7183495/EventToCommandBehaviorBug.zip)
I have added a very basic example to demonstrate the issue. You can run on an iOS simulator. If you go to properties of the iOS project and set Linker Behavior to "Don't link" it runs fine, but if you set it to "Link Framework SDKs Only" it wil throw the "Couldn't resolve the event. Parameter name: EventName" exception
@michelmoorlag I could confirm the issue. Thanks for the repro, I'll work on a fix
@pictos I am glad I could help. A fix would be really nice.
@michelmoorlag I could confirm the issue. Thanks for the repro, I'll work on a fix
@pictos Any progress in this issue? I now see the same issue on Android too.
Hey, @michelmoorlag I didn't find a solution to add on the lib yet, all my tries end up with a solution on the client-side... Also, with the maui release so close I'm not sure if makes sense to investigate a way to work around the linker on Xamarin, I'm saying that because on MAUI the linker that we will use will be from the .net 6 and it's a complete different implementation.
Right now the easy solution is to reference the control and properties that you want to use in a C# file on your project, you don't need to call that file
@pictos That makes sense. Thank you for the effort anyway.
I upgraded tot the latest XF (5.0.0.2401) and XCT (2.0.2) version and that seems to have fixed this issue.
@michelmoorlag thanks for the feedback. I'll close this issue then.
Description
Hi not sure if this is the right place to share this information. We have started to migrate functions in our project to instead use the community Toolkit and we started with converters.
When we build with the setting "Link SDKs Only", the app stops working. Attach is an sample project where we recreated the error on the physics Iphone in debug mode. We also get the error when we build on the App Center in release mode for both Android and Ios.
linkerError.zip
In debug we get this error. Position 6:6. Type xct:InvertedBoolConverter not found in xmlns http://xamarin.com/schemas/2020/toolkit
Steps to Reproduce
To Generate error
Position 6:6. Type xct:InvertedBoolConverter not found in xmlns http://xamarin.com/schemas/2020/toolkit
If we add the mtouch argument: --linkskip=Xamarin.CommunityToolkit it's working.
I do not know much about linking and make code link safe or this is standard and the solution is that we need to add the --linkskip=Xamarin.CommunityToolkit
Expected Behavior
Working no link error
Actual Behavior
Position 6:6. Type xct:InvertedBoolConverter not found in xmlns http://xamarin.com/schemas/2020/toolkit
Basic Information
Workaround
Add --linkskip=Xamarin.CommunityToolkit
Reproduction imagery
Reproduction Link