<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: The start method for OneAgent is not valid in MAUI in Open Q&amp;A</title>
    <link>https://community.dynatrace.com/t5/Open-Q-A/The-start-method-for-OneAgent-is-not-valid-in-MAUI/m-p/231691#M30056</link>
    <description>&lt;P&gt;I install the package from the NuGet package management,&amp;nbsp;&lt;SPAN&gt;building via Visual Studio on&amp;nbsp; Windows.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have one question, where are you insert the start code?&amp;nbsp;App.xaml.cs or other file?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KenXu_0-1702450524460.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/16174iA16139884FCDA130/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KenXu_0-1702450524460.png" alt="KenXu_0-1702450524460.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I got the error when input&amp;nbsp;Agent.Instance.Start(); in App.xaml.cs, but it works fine when I input the in MainApplication.cs file, as the place to input the code has not been mentioned in the document.&lt;/P&gt;&lt;P&gt;I just upload a video in google drive&lt;/P&gt;&lt;P&gt;&lt;A href="https://drive.google.com/file/d/1BzPTZB59ixcubyy4g23IUC88Upmrs5Fc/view?usp=sharing" target="_blank"&gt;https://drive.google.com/file/d/1BzPTZB59ixcubyy4g23IUC88Upmrs5Fc/view?usp=sharing&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 13 Dec 2023 07:26:54 GMT</pubDate>
    <dc:creator>KenXu</dc:creator>
    <dc:date>2023-12-13T07:26:54Z</dc:date>
    <item>
      <title>The start method for OneAgent is not valid in MAUI</title>
      <link>https://community.dynatrace.com/t5/Open-Q-A/The-start-method-for-OneAgent-is-not-valid-in-MAUI/m-p/231553#M30036</link>
      <description>&lt;P&gt;I'm trying to migrate my old Xamarin Form App to .Net MAUI application.&lt;/P&gt;
&lt;P&gt;According to the document for .Net MAUI, I installed&amp;nbsp;&lt;A class="" href="https://www.nuget.org/packages/Dynatrace.OneAgent.MAUI" target="_blank" rel="noopener noreferrer"&gt;&lt;STRONG&gt;Dynatrace.OneAgent.MAUI&lt;/STRONG&gt;&lt;/A&gt;&amp;nbsp;package, add the config file into my project, and input the code into App.xaml.cs file after "InitializeComponent();"&lt;/P&gt;
&lt;PRE&gt;using Dynatrace.MAUI;&lt;BR /&gt;namespace MauiApp2&lt;BR /&gt;{&lt;BR /&gt;    public partial class App : Application&lt;BR /&gt;    {&lt;BR /&gt;         public App()&lt;BR /&gt;         {&lt;BR /&gt;            InitializeComponent();&lt;BR /&gt;            &lt;FONT size="4" color="#FF0000"&gt;Agent.Instance.Start();&lt;/FONT&gt;&lt;BR /&gt;            MainPage = new AppShell();&lt;BR /&gt;         }&lt;BR /&gt;    }&lt;BR /&gt;Agent.Instance.Start();&lt;/PRE&gt;
&lt;P&gt;then I rebuild my porject, and I got following error:&lt;/P&gt;
&lt;PRE&gt;&lt;FONT size="3"&gt;Error CS0103 The name 'Agent' does not exist in the current context&amp;nbsp;&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;If I change the code to:&lt;/P&gt;
&lt;PRE&gt;&lt;FONT size="4"&gt;Dynatrace.MAUI.Agent.Instance.Start();&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;the error will be:&lt;/P&gt;
&lt;PRE&gt;&lt;FONT size="4" color="#000000"&gt;Error CS0234 The type or namespace name 'Agent' does not exist in the namespace 'Dynatrace.MAUI' (are you missing an assembly reference?) &lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-SPOILER&gt;
&lt;P&gt;Platform : .Net MAUI&amp;nbsp;&lt;BR /&gt;Target platform: Android&lt;/P&gt;
&lt;P&gt;Framework : .NET Framework 8.0&lt;/P&gt;
&lt;P&gt;NuGet Package :&amp;nbsp;Dynatrace.OneAgent.MAUI - V1.279.1&lt;/P&gt;
&lt;P&gt;IDE : Visual Studio Community 2022 (64-bit) - Version 17.8.3&lt;/P&gt;
&lt;/LI-SPOILER&gt;
&lt;P&gt;I got the same problem when I create a new .Net MAUI App&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2023 10:51:36 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Open-Q-A/The-start-method-for-OneAgent-is-not-valid-in-MAUI/m-p/231553#M30036</guid>
      <dc:creator>KenXu</dc:creator>
      <dc:date>2023-12-12T10:51:36Z</dc:date>
    </item>
    <item>
      <title>Re: The start method for OneAgent is not valid in MAUI</title>
      <link>https://community.dynatrace.com/t5/Open-Q-A/The-start-method-for-OneAgent-is-not-valid-in-MAUI/m-p/231645#M30047</link>
      <description>&lt;P&gt;Hi there!&lt;/P&gt;&lt;P&gt;Thanks for reaching out. Based on your tests with a new MAUI app using .NET 8, I was able to add our MAUI package and use the same steps that you did to build and start the app with the agent loading properly when the app starts. How are you installing the package? Are you building via Visual Studio or using msbuild? Windows or Mac?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Nick&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2023 16:11:25 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Open-Q-A/The-start-method-for-OneAgent-is-not-valid-in-MAUI/m-p/231645#M30047</guid>
      <dc:creator>nicholas_mcwher</dc:creator>
      <dc:date>2023-12-12T16:11:25Z</dc:date>
    </item>
    <item>
      <title>Re: The start method for OneAgent is not valid in MAUI</title>
      <link>https://community.dynatrace.com/t5/Open-Q-A/The-start-method-for-OneAgent-is-not-valid-in-MAUI/m-p/231691#M30056</link>
      <description>&lt;P&gt;I install the package from the NuGet package management,&amp;nbsp;&lt;SPAN&gt;building via Visual Studio on&amp;nbsp; Windows.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have one question, where are you insert the start code?&amp;nbsp;App.xaml.cs or other file?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KenXu_0-1702450524460.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/16174iA16139884FCDA130/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KenXu_0-1702450524460.png" alt="KenXu_0-1702450524460.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I got the error when input&amp;nbsp;Agent.Instance.Start(); in App.xaml.cs, but it works fine when I input the in MainApplication.cs file, as the place to input the code has not been mentioned in the document.&lt;/P&gt;&lt;P&gt;I just upload a video in google drive&lt;/P&gt;&lt;P&gt;&lt;A href="https://drive.google.com/file/d/1BzPTZB59ixcubyy4g23IUC88Upmrs5Fc/view?usp=sharing" target="_blank"&gt;https://drive.google.com/file/d/1BzPTZB59ixcubyy4g23IUC88Upmrs5Fc/view?usp=sharing&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2023 07:26:54 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Open-Q-A/The-start-method-for-OneAgent-is-not-valid-in-MAUI/m-p/231691#M30056</guid>
      <dc:creator>KenXu</dc:creator>
      <dc:date>2023-12-13T07:26:54Z</dc:date>
    </item>
    <item>
      <title>Re: The start method for OneAgent is not valid in MAUI</title>
      <link>https://community.dynatrace.com/t5/Open-Q-A/The-start-method-for-OneAgent-is-not-valid-in-MAUI/m-p/231821#M30069</link>
      <description>&lt;P&gt;Thanks very much for the video of the issue. It made things a lot easier to understand!&lt;/P&gt;&lt;P&gt;I was originally testing on a Mac so the situation was a little different on my end. I installed Visual Studio on a windows VM so that I could get a better understanding of the issue you are facing. It looks like you have "Windows" selected as the platform to test with (or context I suppose) which is not supported with our NuGet package. To get this to work properly, you have to click the drop down menu near the top left (see images) and select android. This should resolve the issue you are facing.&lt;/P&gt;&lt;P&gt;If you run into any problems with the instructions that I provided, please let me know!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Nick&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2023 19:29:45 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Open-Q-A/The-start-method-for-OneAgent-is-not-valid-in-MAUI/m-p/231821#M30069</guid>
      <dc:creator>nicholas_mcwher</dc:creator>
      <dc:date>2023-12-13T19:29:45Z</dc:date>
    </item>
    <item>
      <title>Re: The start method for OneAgent is not valid in MAUI</title>
      <link>https://community.dynatrace.com/t5/Open-Q-A/The-start-method-for-OneAgent-is-not-valid-in-MAUI/m-p/231871#M30082</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Thanks&amp;nbsp;&lt;/SPAN&gt;&lt;A class="" href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/38469" target="_self"&gt;&lt;SPAN class=""&gt;nicholas_mcwher&amp;nbsp;&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;it works now, what I did is&lt;/P&gt;&lt;P&gt;1: un-check windows platform&amp;nbsp;&lt;/P&gt;&lt;P&gt;2: remove&amp;nbsp;net8.0-maccatalyst from the&amp;nbsp;TargetFrameworks in .csproj file (as there is no maccatalyst options in project propery page)&lt;/P&gt;&lt;PRE&gt;&lt;FONT size="3"&gt;&amp;lt;TargetFrameworks&amp;gt;net8.0-android&amp;lt;/TargetFrameworks&amp;gt;&lt;/FONT&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Thanks,&lt;/P&gt;&lt;P&gt;Ken Xu&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2023 10:03:10 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Open-Q-A/The-start-method-for-OneAgent-is-not-valid-in-MAUI/m-p/231871#M30082</guid>
      <dc:creator>KenXu</dc:creator>
      <dc:date>2023-12-14T10:03:10Z</dc:date>
    </item>
  </channel>
</rss>

