Csla.Configuration.ConfigurationManager Exception

459 Views Asked by At

I'm trying to use CSLA with Xamarin iOS and Andriod. The Xamarin iOS works fine until I add CSLA and do a fetch. It throws an exception on DataPortal.Create(). Having the same issue with Andriod as well. Any help is appreciated.

Error: System.TypeInitializationException: The type initializer for 'Csla.Configuration.ConfigurationManager' threw an exception.

System.TypeLoadException: Could not load type of field 'Csla.Configuration.ConfigurationManager:_connectionStrings' (1) due to: Could not load file or assembly 'System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. assembly:System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a type: member:(null) signature:

CSLA Version: 4.7.101.0 CSLA Iosui Version: 4.7.200.0

1

There are 1 best solutions below

1
Rockford Lhotka On

It sounds like you are referencing the CSLA-Core package instead of the CSLA-Core-NS package.

Thanks to a bug in full .NET, it is necessary to have a package (CSLA-Core) specifically for full .NET environments. But for all other environments/runtimes (including Xamarin) you must use CSLA-Core-NS.

As further information: .NET Standard doesn't include System.Configuration, and so CSLA now provides Csla.Configuration. On full .NET this just delegates to System.Configuration, and on all other platforms it relies on you to provide a dictionary of app settings values loaded from whatever mechanism you choose to use (read from a file, use .NET Core mechanisms, etc.).