Bug 60698 - Microsoft.Extensions.PlatformAbstractions TypeInitializationException
Summary: Microsoft.Extensions.PlatformAbstractions TypeInitializationException
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.3.4
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2017-11-15 15:03 UTC by nicolas.charlas.au
Modified: 2018-01-23 16:01 UTC (History)
3 users (show)

Is this bug a regression?: ---
Last known good build:

stacktrace (6.34 KB, text/plain)
2017-11-15 15:03 UTC, nicolas.charlas.au
Reproduction project (47.81 KB, application/x-zip-compressed)
2017-11-16 14:40 UTC, nicolas.charlas.au

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report for Bug 60698 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description nicolas.charlas.au 2017-11-15 15:03:00 UTC
Created attachment 25722 [details]


We're having an exception when calling the following from either a Shared Project or a Class Library (.NET Standard): 


Stacktrace is attached to this message.
Comment 1 Paul DiPietro [MSFT] 2017-11-15 15:38:56 UTC
Please give us a reproduction project to help investigate the issue when you get a chance. Thanks!
Comment 2 nicolas.charlas.au 2017-11-16 14:40:44 UTC
Created attachment 25737 [details]
Reproduction project
Comment 3 nicolas.charlas.au 2017-11-16 14:42:17 UTC
You'll find a reproduction project attached to this message. The exception will occur in MainPage.xaml.cs where 'Microsoft.Extensions.PlatformAbstractions.PlatformServices.Default' is called
Comment 4 nicolas.charlas.au 2017-11-29 09:16:33 UTC
Provided info
Comment 5 Paul DiPietro [MSFT] 2017-11-29 20:49:00 UTC
I can confirm this crash for now via the reproduction, but I'm not entirely certain what the use case is or if it's a Forms issue in particular. It also appears that this package has not been updated for quite some time. Can you elaborate on the need for this?
Comment 6 nicolas.charlas.au 2017-11-30 10:44:39 UTC
PlatformAbstractions is currently used in gax-dotnet which is a library for communicating with Google Cloud (https://github.com/googleapis/gax-dotnet/blob/9105516e17a4466735ade5ad6e1afdd2ca881f97/src/Google.Api.Gax/VersionHeaderBuilder.cs#L51). 

I'm not really aware of the internal of Xamarin, but it looks like this package is not compatible with it.

Could you confirm me if it's something that the Xamarin/Mono/other team should fix? If not I'll raise an issue on gax-dotnet so the library can be fixed to work with Xamarin.
Comment 7 Charles 2018-01-23 16:01:53 UTC
Issue has been raised on the gax-dotnet github (https://github.com/googleapis/gax-dotnet/issues/231#issuecomment-359447034). 

The Microsoft.Extensions.PlatformAbstractions lib is no longer supported (https://github.com/aspnet/PlatformAbstractions) but seeing as it is a "Microsoft" library it would be nice if Xamarin added support...