AppCenter analytics not starting for WPF - c#

I try to use AppCenter for measuring crashes and telemetrics in my application.
The application is a WPF application, using .NET framework 4.7.2.
I register AppCenter the following way:
AppCenter.Start("MY_KEY", typeof(Analytics), typeof(Crashes));
Directly after the registration I see the following output message:
ERROR: Failed to start service 'Analytics'; skipping it.
Microsoft.AppCenter.AppCenterException: Service type does not contain static 'Instance' property of type IAppCenterService. The service is either not an App Center service or it's unsupported on this platform or the SDK is used from a .NET standard library and the nuget was not also added to the UWP/WPF/WinForms project.
vid Microsoft.AppCenter.AppCenter.StartInstance(Type[] services)
I have the following NuGet versions of AppCenter installed:
Microsoft.AppCenter.Analytics: 3.4.2
Microsoft.AppCenter.Crashes: 3.4.2
Has anybody faced the same problem and knows how to solve this?
Thanks in advance.

The issue is located and corrected.
The cause of this issue was caused by a namespace conflict, another package named Analytics.
Refering the correct namespace with full name, resolved this issue:
AppCenter.Start("MY_KEY", typeof(Microsoft.AppCenter.Analytics.Analytics), typeof(Crashes));

Related

When upgrading to .NET 6, Web Project throws runtime exception

Using an existing .NET 5 MVC Web App, I attempted to upgrade to .NET 6, but encountered this error. I am also using IIS for Windows Authentication--now setup in .NET 6 as "profiles" under Properties -> Debug -> hyperlink (Open debug launch profiles UI). I also included the newer "Microsoft.AspNetCore.Authentication.Negotiate" Nuget package (and associated code) to handle the newer Windows Authentication library.
When the web app launches, I get the following error:
An unhandled exception occurred while processing the request.
InvalidOperationException: Cannot find compilation library location for package 'System.Security.Cryptography.Pkcs'
Microsoft.Extensions.DependencyModel.CompilationLibrary.ResolveReferencePaths(ICompilationAssemblyResolver resolver, List assemblies)
Microsoft.Extensions.DependencyModel.CompilationLibrary.ResolveReferencePaths()
Microsoft.AspNetCore.Mvc.ApplicationParts.AssemblyPartExtensions+<>c.b__0_0(CompilationLibrary library)
System.Linq.Enumerable+SelectManySingleSelectorIterator<TSource, TResult>.MoveNext()
...
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
This does NOT go away if I add the package listed: System.Security.Cryptography.Pkcs
I needed to remove at least 1 Nuget package:
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation -- I removed this one second, but it started working after I did.
Microsoft.Extensions.Hosting -- I removed this one first, but this alone did not fix it. I don't know if this "also" needed to be removed. I assume not, but I'm including, just in case. Removing it did not hurt anything.
Edit: As a WARNING, this will lose the abilities given by Razor.RuntimeCompilation. However, there appears to be a code incompatibility with, I believe, IIS and Razor in .NET 6.
I get this error only when running application (piranha cms) inside docker container.
I had to remove razor runtime compilation to make it work.
// comment out or delete this line
// options.AddRazorRuntimeCompilation = true;

Azure.Mobile in app and AppCenter in framework triggers a "Cannot register two managed types"

I've been having conflicts with Microsoft.Azure.Mobile and Microsoft.AppCenter in a Xamarin iOS project.
I'm creating a framework that will be released as a nuget, in that framework I reference AppCenter. The app where I'm testing my nuget has a reference to Microsoft.Azure.Mobile, which references the same Microsoft.AppCenter nuget triggering the following error:
Project/iOS/MTOUCH: Error MT4116: Could not register the assembly 'Microsoft.Azure.Mobile.iOS.Bindings': error MT4118: Cannot register two managed types ('Microsoft.Azure.Mobile.iOS.Bindings.MSCustomProperties, Microsoft.Azure.Mobile.iOS.Bindings' and 'Microsoft.AppCenter.iOS.Bindings.MSCustomProperties, Microsoft.AppCenter.iOS.Bindings') with the same native name ('MSCustomProperties'). (MT4116)(Project.iOS)
I tried the following solutions with no success:
1: https://forums.xamarin.com/discussion/comment/54126/#Comment_54126
2: https://github.com/xamarin/xamarin-macios/issues/4721
Would love some help :)
The problem was that the Microsoft.Azure.Mobile it's an old package no longer being supported and is using the AppCenter services, I removed that package and just added the most recent package from AppCenter which uses the same services.

Sytem.Reflection.Emit error when establishing XML client in Azure Function

Trying to establish an xmlrpc to a third party web service from my function app. It works fine from localhost, and indeed, it works in other functions but when published to Azure I'm getting this error:
System.MissingMethodException: Method not found: 'System.Reflection.Emit.AssemblyBuilder System.AppDomain.DefineDynamicAssembly(System.Reflection.AssemblyName, System.Reflection.Emit.AssemblyBuilderAccess)'.
at CookComputing.XmlRpc.XmlRpcProxyGen.BuildAssembly(Type itf, String assemblyName, String moduleName, String typeName, AssemblyBuilderAccess access)
at CookComputing.XmlRpc.XmlRpcProxyGen.Create(Type itf)
at CookComputing.XmlRpc.XmlRpcProxyGen.Create[T]()
It's failing at this line:
_serviceClient = XmlRpcProxyGen.Create<IServiceClient>();
IServiceClient is an interface that looks like this:
using CookComputing.XmlRpc;
using System;
namespace App.Core.Helpers.Service
{
[XmlRpcUrl("https://some.url")]
public interface IServiceClient : IXmlRpcProxy
// methods
}
I've manually added the System.Reflection.Emit package to the solution in an attempt to fix it, but no joy. The exact same code is running fine in other apps we have in Azure. The app is running .Net framework 4.6.1.
This is a problem which can occur when there is an old version of a DLL still lingering somewhere around. Make sure that the latest assemblies are deployed and no duplicated older assemblies are hiding in certain folders. Your best bet would be to delete every built item(Clean Build) and Rebuild/redeploy the entire solution.
In particular, be sure an old version is not in the GAC.
This can help to Remove an Assembly from the Global Assembly Cache.
I was facing same issue as you were facing.
What I found solution is that, I was using asp.net core framework So I have to change it into net 4.5 framework. And that's all.
Issue resolved.
So you may try that.

MonoTouch - System.ServiceModel.Dispatcher.ClientOperation fails ("Could not Load signature of [type]).

We have a custom JSON WCF binding that we use in our .net SDK (to support JSON similar to the WebHttpBinding). Our SDK is a PCL supporting .net 4.5, Win8, IOS, Android profile - It works in our Windows Desktop application, and Android without any problem. We are just diving into MonoTouch, and have been tracing down why our custom WCF bindings were not working correctly. We were able to identify that in our WCF class that implements the System.ServiceModel.Description.IOperationBehavior interface, MonoTouch fails when trying to handle System.ServiceModel.Dispatcher.ClientOperation.
The exact error is mono "Could not load the signature of (our custom type) Failed for unknown reasons."
When I configure the .csproj Linker Options to "Link SDK assemblies only" and attempt to compile, I get the error:
Xamarin.iOS 8.6.1 Business Edition using framework: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk
MTOUCHTASK: error MT2002: Failed to resolve "System.ServiceModel.Dispatcher.ClientOperation" reference from "System.ServiceModel.Primitives, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
Task "MTouchTask" execution --
Looking for any kind of work around, as we need the client operation to configure the "Formatter" property when passed in via the ApplyClientBehavior method.
Any assistance would be greatly appreciated.
I submitted this problem to Xamarin, and they confirmed that my report is a bug in Mono 3.1 - they have resolved it in Mono 4.0 but that is not out yet at the time of this writing. Hope this helps someone else out who might spend hours trying to resolve it.
Issue was the PCL library ClientOperation wouldn't work, but under the MonoTouch assmebly it was fine. Xamarin opened a private bug, so I don't have a reference number.

nettiers data class library not recognized

I needed to make a console application using nettiers class libraries. I created a new Console Application project, added references to all the libraries from NetTiers and created an app.config file with all the necessary configurations. I get intellisense and no errors and everything when I am doing the coding, but when I go to compile the application, I'm getting an error that PPGEDI.Data doesn't exist.
I only have 1 line in the program.cs Main method:
PPGEDI.Entities.VansEntity van
= DataRepository.VansEntityProvider.GetById(16);
I'm getting the following error:
Error 93
The type or namespace name 'Data'
does not exist in the namespace 'PPGEDI'
(are you missing an assembly reference?)
It's frustrating, because I know I've added the assembly reference:
I'm using Visual Studio 2010, with C# and .NET 4.0. Can anyone give me an idea as to what I need to do to get this to work.
As a note, this works if I use the same statement in a method on an ASPX page in the web application generated by nettiers.
#BrokenGlass, you were absolutely correct. I double checked and it was
set to ".NET Framework Client Profile", I changed it to .NET 4 and
it's working now, can you put that as an answer?
You are using the .NET client profile in your console app which is a "minified" version that doesn’t contain all assemblies.
The problem is that when your app adds a reference to a class library that is targeting the full framework, references to the "full" framework assembly will not resolve. This results in the rather non-forthcoming error message that you see. Switching to the the full .NET 4 as target framework will resolve the issue.
For a more in depth overview of the problem and the .NET 4 Client Profile in general also see "What’s new in .NET Framework 4 Client Profile RTM"

Categories