We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

TargetInvocationException Error

I'm following step-by-step the "Getting Started"  https://help.syncfusion.com/maui/tabview/getting-started 

After adding the TabView and on the first run, I'm getting the following errror.

System.Reflection.TargetInvocationException

  HResult=0x80131604

  Message=Exception has been thrown by the target of an invocation.

  Source=System.Private.CoreLib

  StackTrace:

   at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)

   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

   at Microsoft.Maui.Controls.Xaml.ApplyPropertiesVisitor.Visit(ElementNode node, INode parentNode)

   at Microsoft.Maui.Controls.Xaml.ElementNode.Accept(IXamlNodeVisitor visitor, INode parentNode)

   at Microsoft.Maui.Controls.Xaml.ListNode.Accept(IXamlNodeVisitor visitor, INode parentNode)

   at Microsoft.Maui.Controls.Xaml.ElementNode.Accept(IXamlNodeVisitor visitor, INode parentNode)

   at Microsoft.Maui.Controls.Xaml.RootNode.Accept(IXamlNodeVisitor visitor, INode parentNode)

   at Microsoft.Maui.Controls.Xaml.XamlLoader.Load(Object view, String xaml, Assembly rootAssembly, Boolean useDesignProperties)

   at Microsoft.Maui.Controls.Xaml.XamlLoader.Load(Object view, Type callingType)

   at Microsoft.Maui.Controls.Xaml.Extensions.LoadFromXaml[TXaml](TXaml view, Type callingType)

   at MauiTabViewTest.MainPage.InitializeComponent() in C:\Temp\MauiTabViewTest\MauiTabViewTest\Microsoft.Maui.Controls.SourceGen\Microsoft.Maui.Controls.SourceGen.CodeBehindGenerator\MainPage.xaml.sg.cs:line 26

   at MauiTabViewTest.MainPage..ctor() in C:\Temp\MauiTabViewTest\MauiTabViewTest\MainPage.xaml.cs:line 9

   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions)


  This exception was originally thrown at this call stack:

    [External Code]


Inner Exception 1:

FileLoadException: Could not load file or assembly 'WinRT.Runtime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=99ea127f02d97709'. The located assembly's manifest definition does not match the assembly reference. (0x80131040)




3 Replies

SR Shivani Ramakrishnan Syncfusion Team December 1, 2022 01:03 PM UTC

Hi Frederick,


We have checked your query. The issue "TargetInvocationException error" is not produced. Kindly let us know what .NET version and Visual Studio version is used . We have attached the sample for your reference, please get it from the attachment.We ask you to try our sample and if your requirement is different, please explain to us briefly and share the replication steps with the sample and the reported issue platform details. It will help us to provide the proper solution at the easiest.  Please let us know if you need any other details.


Regards,

Shivani





Attachment: TabViewApp_88697176.zip


FS Frederick Switzer replied to Shivani Ramakrishnan December 2, 2022 05:35 PM UTC

Shivani, 

I'm using VS Community 2022 Ver 17.4.0 Preview 1.0

.NET 6.0 


I'm getting the error when I add my first item:

<tabView:SfTabItem Header="Call">

                    <tabView:SfTabItem.Content>

                        <Grid BackgroundColor="Red" />

                    </tabView:SfTabItem.Content>

                </tabView:SfTabItem>

I can't convert to .NET 7.0  too many breaking changes.  

Is there a prior version of the TabView nuGet?



SR Shivani Ramakrishnan Syncfusion Team December 5, 2022 02:10 PM UTC

Hi Frederick,


We have checked your query. The issue "TargetInvocationException error" is not produced. With our Volume 3 2022 SP release, we have the minimum supporting VS version as 17.4.0 Preview 6.0 as stated in the below page. Please update your Visual Studio and check whether the sample provided in our last update works for you.


Installation and Deployment process for Syncfusion .NET MAUI products


Please let us know any other details.


Regards,
Shivani


Loader.
Up arrow icon