I already update all my nugets. When I build it in debug mode there is no problem. Is there a workaround for this or even a proper solution?
Here is my startup method where i load the appsettings with the embedfileprovider for the configurationbuilder.
public AppStartup(
Action<IConfigurationBuilder> platformConfiguration,
Action<ILoggingBuilder, IConfigurationRoot> logging)
{
IConfigurationBuilder builder = new ConfigurationBuilder()
.AddJsonFile(new EmbeddedFileProvider(typeof(AppStartup).Assembly, typeof(AppStartup).Namespace), "appsettings.json", false, false);
#if DEBUG
builder.AddJsonFile(
new EmbeddedFileProvider(typeof(AppStartup).Assembly, typeof(AppStartup).Namespace), "appsettings.development.json", true, false);
#endif
platformConfiguration?.Invoke(builder);
_configuration = builder.Build(); // <= error thrown here
_logging = logging;
}
I get follow error when i try to run my Xamarin UWP app in release mode:
at System.Func`2.EndInvoke(IAsyncResult result) in f:\dd\ndp\fxcore\CoreRT\src\System.Private.CoreLib\shared\System\Runtime\Intrinsics\X86\Sse41.PlatformNotSupported.cs:line 551
at System.Reflection.Runtime.Assemblies.NativeFormat.NativeFormatRuntimeAssembly.GetManifestResourceInfo(String resourceName) in f:\dd\ndp\fxcore\CoreRT\src\System.Private.Reflection.Core\src\System\Reflection\Runtime\Assemblies\NativeFormat\NativeFormatRuntimeAssembly.cs:line 153
at Microsoft.Extensions.FileProviders.EmbeddedFileProvider.GetFileInfo(String subpath)
at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load(Boolean reload)
at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load()
at Microsoft.Extensions.Configuration.ConfigurationRoot..ctor(IList`1 providers)
at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build()
at MYNAMESPACE.AppStartup..ctor(Action`1 platformConfiguration, Action`2 logging) in MYFILEPATH\AppStartup.cs:line 38
at MYNAMESPACE.UWP.App..ctor() in MYFILEPATH\App.xaml.cs:line 22
at MYNAMESPACE.UWP.Program.<>c.<Main>b__0_0(ApplicationInitializationCallbackParams p) in MYFILEPATH\obj\x86\Release\App.g.i.cs:line 24
at System.Func`2.Invoke(T arg)
at __Interop.ReverseComStubs.Stub_5[TArg0](Object __this, Void* unsafe_e, IntPtr __methodPtr)
UWP csproj nugets:
<PackageReference Include="Microsoft.AppCenter.Analytics">
<Version>4.4.0</Version>
</PackageReference>
<PackageReference Include="MonkeyCache.FileStore">
<Version>1.5.2</Version>
</PackageReference>
<PackageReference Include="Serilog">
<Version>2.10.0</Version>
</PackageReference>
<PackageReference Include="Serilog.Sink.AppCenter">
<Version>1.3.0</Version>
</PackageReference>
<PackageReference Include="Serilog.Sinks.Console">
<Version>4.0.0</Version>
</PackageReference>
<PackageReference Include="Serilog.Sinks.File">
<Version>5.0.0</Version>
</PackageReference>
<PackageReference Include="Serilog.Sinks.Trace">
<Version>3.0.0</Version>
</PackageReference>
<PackageReference Include="Shiny">
<Version>2.3.0.2906</Version>
</PackageReference>
<PackageReference Include="Shiny.BluetoothLE">
<Version>2.3.0.2906</Version>
</PackageReference>
<PackageReference Include="Shiny.Core">
<Version>2.3.0.2906</Version>
</PackageReference>
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2196" />
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform" Version="6.2.13" />
<PackageReference Include="Xamarin.Essentials" Version="1.7.0" />
shared app csproj nugets:
<PackageReference Include="Microsoft.AppCenter.Analytics" Version="4.4.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="6.0.0" />
<PackageReference Include="Serilog" Version="2.10.0" />
<PackageReference Include="Serilog.AspNetCore" Version="4.1.0" />
<PackageReference Include="Serilog.Sink.AppCenter" Version="1.3.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="Shiny" Version="2.3.0.2906" />
<PackageReference Include="Shiny.BluetoothLE" Version="2.3.0.2906" />
<PackageReference Include="Shiny.Core" Version="2.3.0.2906" />
<PackageReference Include="Xamarin.CommunityToolkit" Version="1.3.0" />
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2196" />
<PackageReference Include="Xamarin.Essentials" Version="1.7.0" />
My Environment:
.NET SDK (reflecting any global.json):
Version: 6.0.100-rc.2.21505.57
Commit: ab39070116
Runtime Environment:
OS Name: Windows
OS Version: 10.0.22000
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\6.0.100-rc.2.21505.57\
Host (useful for support):
Version: 6.0.0-rc.2.21480.5
Commit: 6b11d64e7e
.NET SDKs installed:
5.0.302 [C:\Program Files\dotnet\sdk]
6.0.100-rc.2.21505.57 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 3.1.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0-rc.2.21480.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.0-rc.2.21480.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.0-rc.2.21501.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
temporary workaround
builder
.SetBasePath(Package.Current.InstalledLocation.Path)
.AddJsonFile("appsettings.json", optional: false)
.AddJsonFile("appsettings.uwp.json", optional: false);
Update
I update all the nugets to the latest .net 6 version and also xamarin to version 5.