question

ledien-8573 avatar image
0 Votes"
ledien-8573 asked ·

Could not load file or assembly 'Microsoft.AppCenter.Analytics, Version=0.0.0.0, Culture=neutral ...

I have project UWP by c++ name: TestAppCenter and " Window Runtime Component" by C# name :CoreRuntime .I have added "App center SDK" by install Microsoft.AppCenter.Analytics and Microsoft.AppCenter.Crashes packages for "CoreRuntime" .

alt text

In project UWP (TestAppCenter ) i call to function in CoreRuntime to init app center like :

 App::App()
 {
     InitializeComponent();
     Suspending += ref new SuspendingEventHandler(this, &App::OnSuspending);
     //CoreRuntime::Class1 ^ob = ref new Class1();
     //ob->InitAppCenter();
     CoreRuntime::Class1::InitAppCenter();
 }

But it show error :

 **WinRT information: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.AppCenter.Analytics, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified**.

Here is my source test :

 //Class1.cs
 using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 using Microsoft.AppCenter;
 using Microsoft.AppCenter.Analytics;
 using Microsoft.AppCenter.Crashes;
 namespace CoreRuntime
 {
     public sealed class Class1
     {
         public static void InitAppCenter()
         {
             AppCenter.Start("afc4f213-f02e-4f74-ae42-6386100bdaf8", typeof(Analytics), typeof(Crashes));
 
         }
     }
 }
 

 //App.xaml.cpp
 App::App()
 {
     InitializeComponent();
     Suspending += ref new SuspendingEventHandler(this, &App::OnSuspending);
     //CoreRuntime::Class1 ^ob = ref new Class1();
     //ob->InitAppCenter();
     CoreRuntime::Class1::InitAppCenter();//<--- call here.
 }    
   

I try call this function with static method , instance object. Could you please show me why it generate this error ? And solution for this . Thank!!

uwpwindows-runtime
· 3
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

We have noticed this issue and the team is tracking this. If the team finds the reason, they will fix it in next version.

0 Votes 0 · ·

Hello, i have some issue, where we can track issue resolution?

0 Votes 0 · ·

This doesn't appear to be specific to Microsoft.AppCenter.Analytics. We believe this problem is due to an issue calling .net based WinRT components from C++/CX or C++ WinRT projects. Can you please confirm this hypothesis by building a quick C# project and attempting to call the Microsoft.AppCenter.Analytics components?

-James

0 Votes 0 · ·

1 Answer

AlexanderSklar avatar image
0 Votes"
AlexanderSklar answered ·

@ledien-8573 We've identified a fix and we're pursuing a public doc update. In the meantime here's how to consume a C# WinRT component from C++/WinRT

· Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.