Bug 41240 - Invalid IL code in System.Configuration.ConfigurationManager:get_AppSettings (): method body is empty.
Summary: Invalid IL code in System.Configuration.ConfigurationManager:get_AppSettings ...
Alias: None
Product: Android
Classification: Xamarin
Component: Mono runtime / AOT Compiler ()
Version: 6.0.0
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Jonathan Pryor
Depends on:
Reported: 2016-05-22 20:46 UTC by Alex Koon
Modified: 2017-10-04 16:01 UTC (History)
3 users (show)

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

Screen shoot error (104.49 KB, image/jpeg)
2016-11-11 13:54 UTC, André

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 on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Alex Koon 2016-05-22 20:46:11 UTC
Invalid IL code in System.Configuration.ConfigurationManager:get_AppSettings (): method body is empty.

When trying to retrieve an app setting from app.config. The key I am looking for is present in the file. Why is this happening? 

MonoAndroid 6.0.0
Visual Studio Community 15 with Xamarin
Windows 10 Pro

<add key="key" value="value"

using System.Configuration;
string key = ConfigurationManager.AppSettings["key"];

The steps to reproduce this are trivial. Enter the appSetting in the app.config and try to extract the value in the code. What is going on here? I get the same error if I try doing this.

Configuration config = ConfigurationManager.OpenExeConfiguration(path to file);
Comment 1 Jonathan Pryor 2016-05-22 21:55:06 UTC
Are you sure you're using Xamarin.Android? Xamarin.Android does not provide System.Configuration.ConfigurationManager, and the only included types in the v1.0 framework directory -- e.g. mscorlib.dll, System.dll -- are:

> System.Web.Services.Configuration.XmlFormatExtensionAttribute
> System.Web.Services.Configuration.XmlFormatExtensionPointAttribute
> System.Web.Services.Configuration.XmlFormatExtensionPrefixAttribute

> System.Xml.XmlConfiguration.XmlReaderSection
> System.Xml.XmlConfiguration.XsltConfigSection

> System.Configuration.Assemblies.AssemblyHash
> System.Configuration.Assemblies.AssemblyHashAlgorithm
> System.Configuration.Assemblies.AssemblyVersionCompatibility
> System.Reflection.AssemblyConfigurationAttribute
> System.Runtime.Remoting.RemotingConfiguration

Could you please attach a repro project?
Comment 2 André 2016-11-11 13:53:31 UTC
I have the same error, see attach screen shot.

I think we are confuse by Visual Studio...

We are able to reference System.Configuration.dll in a droid project, with no error/warning until we run our project.
Comment 3 André 2016-11-11 13:54:39 UTC
Created attachment 18427 [details]
Screen shoot error
Comment 4 Jon Douglas [MSFT] 2017-10-04 16:01:32 UTC
Because we have not received a reply to our request for more information we are closing this issue. If you are still encountering this issue, please reopen the ticket with the requested information. Thanks!

For a full list of assemblies that are supported in Xamarin.Android you can find documentation here:


Thus https://bugzilla.xamarin.com/show_bug.cgi?id=41240#c1 is saying that you cannot add this assembly to your project as it's not supported.