diff --git a/ReferenceNetFWOnlyAndNewerDeps/FunctionAppV1/.gitignore b/ReferenceNetFWOnlyAndNewerDeps/FunctionAppV1/.gitignore new file mode 100644 index 0000000..ff5b00c --- /dev/null +++ b/ReferenceNetFWOnlyAndNewerDeps/FunctionAppV1/.gitignore @@ -0,0 +1,264 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# Azure Functions localsettings file +local.settings.json + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# DNX +project.lock.json +project.fragment.lock.json +artifacts/ + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# TODO: Comment the next line if you want to checkin your web deploy settings +# but database connection strings (with potential passwords) will be unencrypted +#*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config +# NuGet v3's project.json files produces more ignoreable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +node_modules/ +orleans.codegen.cs + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush +.cr/ + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc \ No newline at end of file diff --git a/ReferenceNetFWOnlyAndNewerDeps/FunctionAppV1/Function1.cs b/ReferenceNetFWOnlyAndNewerDeps/FunctionAppV1/Function1.cs new file mode 100644 index 0000000..0f48ddb --- /dev/null +++ b/ReferenceNetFWOnlyAndNewerDeps/FunctionAppV1/Function1.cs @@ -0,0 +1,67 @@ +using System.Linq; +using System.Net; +using System.Net.Http; +using Microsoft.Azure.WebJobs; +using Microsoft.Azure.WebJobs.Extensions.Http; +using Microsoft.Azure.WebJobs.Host; +using Microsoft.EntityFrameworkCore; + +namespace FunctionAppV1 +{ + public class Person + { + public int Id { get; set; } + public string Name { get; set; } + } + + public class MyDbContext : DbContext + { + public DbSet People { get; set; } + + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) + { + optionsBuilder.UseInMemoryDatabase("test"); + } + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + modelBuilder.Entity().HasData( + new Person { Id = 1, Name = "AAAA" }, + new Person { Id = 2, Name = "BBBB" }, + new Person { Id = 3, Name = "CCCC" } + ); + } + } + + public static class Function1 + { + [FunctionName("FunctionV1")] + public static HttpResponseMessage Run( + [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] + HttpRequestMessage req, + TraceWriter log) + { + log.Info("Running V1..."); + + // **** THIS EXECUTES SUCCESSFULLY IN V1 + using (var connection = + new Microsoft.AnalysisServices.AdomdClient.AdomdConnection("Provider=MSOLAP;Data Source=localhost")) + { + // only including the Open call to show exception; otherwise, it requires access to a SSAS server + connection.Open(); + } + + // **** THIS FAILS IN V1 + // System.IO.FileNotFoundException: + //'Could not load file or assembly 'System.ComponentModel.Annotations, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.' + using (var context = new MyDbContext()) + { + context.Database.EnsureDeleted(); + context.Database.EnsureCreated(); + var data = string.Join(", ", context.People.Select(p => p.Name)); + } + + return req.CreateResponse(HttpStatusCode.OK, "Completed!"); + } + } +} diff --git a/ReferenceNetFWOnlyAndNewerDeps/FunctionAppV1/FunctionAppV1.csproj b/ReferenceNetFWOnlyAndNewerDeps/FunctionAppV1/FunctionAppV1.csproj new file mode 100644 index 0000000..6c5613c --- /dev/null +++ b/ReferenceNetFWOnlyAndNewerDeps/FunctionAppV1/FunctionAppV1.csproj @@ -0,0 +1,23 @@ + + + net461 + v1 + + + + + + + + + + + + PreserveNewest + + + PreserveNewest + Never + + + diff --git a/ReferenceNetFWOnlyAndNewerDeps/FunctionAppV1/host.json b/ReferenceNetFWOnlyAndNewerDeps/FunctionAppV1/host.json new file mode 100644 index 0000000..7a73a41 --- /dev/null +++ b/ReferenceNetFWOnlyAndNewerDeps/FunctionAppV1/host.json @@ -0,0 +1,2 @@ +{ +} \ No newline at end of file diff --git a/ReferenceNetFWOnlyAndNewerDeps/FunctionAppV2/.gitignore b/ReferenceNetFWOnlyAndNewerDeps/FunctionAppV2/.gitignore new file mode 100644 index 0000000..ff5b00c --- /dev/null +++ b/ReferenceNetFWOnlyAndNewerDeps/FunctionAppV2/.gitignore @@ -0,0 +1,264 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# Azure Functions localsettings file +local.settings.json + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# DNX +project.lock.json +project.fragment.lock.json +artifacts/ + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# TODO: Comment the next line if you want to checkin your web deploy settings +# but database connection strings (with potential passwords) will be unencrypted +#*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config +# NuGet v3's project.json files produces more ignoreable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +node_modules/ +orleans.codegen.cs + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush +.cr/ + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc \ No newline at end of file diff --git a/ReferenceNetFWOnlyAndNewerDeps/FunctionAppV2/Function1.cs b/ReferenceNetFWOnlyAndNewerDeps/FunctionAppV2/Function1.cs new file mode 100644 index 0000000..8425ee2 --- /dev/null +++ b/ReferenceNetFWOnlyAndNewerDeps/FunctionAppV2/Function1.cs @@ -0,0 +1,68 @@ +using System.Linq; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Azure.WebJobs; +using Microsoft.Azure.WebJobs.Extensions.Http; +using Microsoft.Azure.WebJobs.Host; +using Microsoft.EntityFrameworkCore; + +namespace FunctionAppV2 +{ + public class Person + { + public int Id { get; set; } + public string Name { get; set; } + } + + public class MyDbContext : DbContext + { + public DbSet People { get; set; } + + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) + { + optionsBuilder.UseInMemoryDatabase("test"); + } + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + modelBuilder.Entity().HasData( + new Person { Id = 1, Name = "AAAA" }, + new Person { Id = 2, Name = "BBBB" }, + new Person { Id = 3, Name = "CCCC" } + ); + } + } + + public static class Function1 + { + [FunctionName("FunctionV2")] + public static IActionResult Run( + [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] + HttpRequest req, + TraceWriter log) + { + log.Info("Running V2..."); + + // **** THIS EXECUTES SUCCESSFULLY IN V2 + using (var context = new MyDbContext()) + { + context.Database.EnsureDeleted(); + context.Database.EnsureCreated(); + var data = string.Join(", ", context.People.Select(p => p.Name)); + } + + // **** THIS FAILS IN V2 + // System.Private.CoreLib: Exception while executing function: FunctionV2. + // Microsoft.AnalysisServices.AdomdClient: Could not load type 'System.Security.Principal.WindowsImpersonationContext' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. + using (var connection = + new Microsoft.AnalysisServices.AdomdClient.AdomdConnection("Provider=MSOLAP;Data Source=localhost")) + { + // only including the Open call to show exception; otherwise, it requires access to a SSAS server + connection.Open(); + // ... more code + } + + return (ActionResult)new OkObjectResult("Completed!"); + } + } +} diff --git a/ReferenceNetFWOnlyAndNewerDeps/FunctionAppV2/FunctionAppV2.csproj b/ReferenceNetFWOnlyAndNewerDeps/FunctionAppV2/FunctionAppV2.csproj new file mode 100644 index 0000000..cd54dcc --- /dev/null +++ b/ReferenceNetFWOnlyAndNewerDeps/FunctionAppV2/FunctionAppV2.csproj @@ -0,0 +1,20 @@ + + + netstandard2.0 + v2 + + + + + + + + + PreserveNewest + + + PreserveNewest + Never + + + \ No newline at end of file diff --git a/ReferenceNetFWOnlyAndNewerDeps/FunctionAppV2/host.json b/ReferenceNetFWOnlyAndNewerDeps/FunctionAppV2/host.json new file mode 100644 index 0000000..7a73a41 --- /dev/null +++ b/ReferenceNetFWOnlyAndNewerDeps/FunctionAppV2/host.json @@ -0,0 +1,2 @@ +{ +} \ No newline at end of file diff --git a/ReferenceNetFWOnlyAndNewerDeps/ReferenceNetFWOnlyAndNewerDeps.sln b/ReferenceNetFWOnlyAndNewerDeps/ReferenceNetFWOnlyAndNewerDeps.sln new file mode 100644 index 0000000..d9bcec7 --- /dev/null +++ b/ReferenceNetFWOnlyAndNewerDeps/ReferenceNetFWOnlyAndNewerDeps.sln @@ -0,0 +1,36 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27703.2042 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FunctionAppV1", "FunctionAppV1\FunctionAppV1.csproj", "{3D7422BF-05E8-49F9-82C6-171D698ED86A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FunctionAppV2", "FunctionAppV2\FunctionAppV2.csproj", "{117C31F9-EE10-47E8-B62D-374C601F8C34}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{E479392B-690C-450D-AA19-E8C71E064097}" + ProjectSection(SolutionItems) = preProject + readme.md = readme.md + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3D7422BF-05E8-49F9-82C6-171D698ED86A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3D7422BF-05E8-49F9-82C6-171D698ED86A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3D7422BF-05E8-49F9-82C6-171D698ED86A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3D7422BF-05E8-49F9-82C6-171D698ED86A}.Release|Any CPU.Build.0 = Release|Any CPU + {117C31F9-EE10-47E8-B62D-374C601F8C34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {117C31F9-EE10-47E8-B62D-374C601F8C34}.Debug|Any CPU.Build.0 = Debug|Any CPU + {117C31F9-EE10-47E8-B62D-374C601F8C34}.Release|Any CPU.ActiveCfg = Release|Any CPU + {117C31F9-EE10-47E8-B62D-374C601F8C34}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {801EB04F-6280-4743-A641-44CAC3D2E9D3} + EndGlobalSection +EndGlobal diff --git a/ReferenceNetFWOnlyAndNewerDeps/readme.md b/ReferenceNetFWOnlyAndNewerDeps/readme.md new file mode 100644 index 0000000..c16cce2 --- /dev/null +++ b/ReferenceNetFWOnlyAndNewerDeps/readme.md @@ -0,0 +1,86 @@ +This scenario is not currently supported in either V1 (version=1.0.11913.0) or V2 (version=2.0.11933.0). It uses both [Microsoft.EntityFrameworkCore v2.1.1](https://www.nuget.org/packages/Microsoft.EntityFrameworkCore/) and [Microsoft.AnalysisServices.AdomdClient](https://www.nuget.org/packages/Microsoft.AnalysisServices.AdomdClient.retail.amd64/) NuGet packages. + +The AdomdClient package can be used successfully in a V1 function app. However, this is not the case for EF Core and any attempt to use it fails with a **FileNotFoundException** (*Could not load file or assembly 'System.ComponentModel.Annotations, Version=4.2.0.0, ...'*). + +When the same code is moved to a V2 function app, the EF Core code starts to work, but the AdomdClient fails with a **TypeLoadException** (*Could not load type 'System.Security.Principal.WindowsImpersonationContext' from assembly 'mscorlib, Version=4.0.0.0, ...'*). Note that when you add the AdomdClient package to the V2 project, you do get a warning alerting that this package targets .NET Framework, not .NET Standard and, presumably, WindowsImpersonationContext is not implemented in .NET Core, thus the failure. +``` +Package 'Microsoft.AnalysisServices.AdomdClient.retail.amd64 15.3.1' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project. +``` + +The following exception is raised in the V1 app. +``` +System.IO.FileNotFoundException: Could not load file or assembly 'System.ComponentModel.Annotations, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. +File name: 'System.ComponentModel.Annotations, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' + at Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.CoreConventionSetBuilder.CreateConventionSet() + at Microsoft.EntityFrameworkCore.Infrastructure.ModelSource.CreateConventionSet(IConventionSetBuilder conventionSetBuilder) + at Microsoft.EntityFrameworkCore.Infrastructure.ModelSource.CreateModel(DbContext context, IConventionSetBuilder conventionSetBuilder, IModelValidator validator) + at Microsoft.EntityFrameworkCore.Infrastructure.ModelSource.<>c__DisplayClass5_0.b__1() + at System.Lazy`1.CreateValue() + at System.Lazy`1.LazyInitValue() + at System.Lazy`1.get_Value() + at Microsoft.EntityFrameworkCore.Infrastructure.ModelSource.GetModel(DbContext context, IConventionSetBuilder conventionSetBuilder, IModelValidator validator) + at Microsoft.EntityFrameworkCore.Internal.DbContextServices.CreateModel() + at Microsoft.EntityFrameworkCore.Internal.DbContextServices.get_Model() + at Microsoft.EntityFrameworkCore.Infrastructure.EntityFrameworkServicesBuilder.<>c.b__7_1(IServiceProvider p) + at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, ServiceProviderEngineScope scope) + at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite callSite, TArgument argument) + at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProviderEngineScope scope) + at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite callSite, TArgument argument) + at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProviderEngineScope scope) + at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite callSite, TArgument argument) + at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProviderEngineScope scope) + at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite callSite, TArgument argument) + at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.b__0(ServiceProviderEngineScope scope) + at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope) + at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType) + at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType) + at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider) + at Microsoft.EntityFrameworkCore.DbContext.get_DbContextDependencies() + at Microsoft.EntityFrameworkCore.DbContext.get_InternalServiceProvider() + at Microsoft.EntityFrameworkCore.DbContext.Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure.get_Instance() + at Microsoft.EntityFrameworkCore.Internal.InternalAccessorExtensions.GetService[TService](IInfrastructure`1 accessor) + at Microsoft.EntityFrameworkCore.Infrastructure.AccessorExtensions.GetService[TService](IInfrastructure`1 accessor) + at Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade.get_ProviderName() + at Microsoft.EntityFrameworkCore.InMemoryDatabaseFacadeExtensions.IsInMemory(DatabaseFacade database) + at StatsEngine.Metadata.StatsEngineDbContextFactory.Create(DbContextOptions`1 overrideOptions) + at StatsEngine.Metadata.StatsEngineData.d__5.MoveNext() +--- End of stack trace from previous location where exception was thrown --- + at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) + at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) + at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() + at AzureFunctionsV1.Function1.d__2.MoveNext() + +=== Pre-bind state information === +LOG: DisplayName = System.ComponentModel.Annotations, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + (Fully-specified) +LOG: Appbase = file:///C:/Users/Fernando/AppData/Local/AzureFunctionsTools/Releases/1.3.0/cli/ +LOG: Initial PrivatePath = NULL +Calling assembly : Microsoft.EntityFrameworkCore, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60. +=== +LOG: This bind starts in LoadFrom load context. +WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load(). +LOG: Using application configuration file: C:\Users\Fernando\AppData\Local\AzureFunctionsTools\Releases\1.3.0\cli\func.exe.Config +LOG: Using host configuration file: +LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config. +LOG: Post-policy reference: System.ComponentModel.Annotations, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a +LOG: Attempting download of new URL file:///C:/Users/Fernando/AppData/Local/AzureFunctionsTools/Releases/1.3.0/cli/System.ComponentModel.Annotations.DLL. +LOG: Attempting download of new URL file:///C:/Users/Fernando/AppData/Local/AzureFunctionsTools/Releases/1.3.0/cli/System.ComponentModel.Annotations/System.ComponentModel.Annotations.DLL. +LOG: Attempting download of new URL file:///C:/Users/Fernando/AppData/Local/AzureFunctionsTools/Releases/1.3.0/cli/System.ComponentModel.Annotations.EXE. +LOG: Attempting download of new URL file:///C:/Users/Fernando/AppData/Local/AzureFunctionsTools/Releases/1.3.0/cli/System.ComponentModel.Annotations/System.ComponentModel.Annotations.EXE. +LOG: Attempting download of new URL file:///C:/projects/AzureFunctionsV1/bin/Debug/net472/bin/System.ComponentModel.Annotations.DLL. +WRN: Comparing the assembly name resulted in the mismatch: Build Number +LOG: Attempting download of new URL file:///C:/projects/AzureFunctionsV1/bin/Debug/net472/bin/System.ComponentModel.Annotations/System.ComponentModel.Annotations.DLL. +LOG: Attempting download of new URL file:///C:/projects/MetadataEFCore/AzureFunctionsV1/bin/Debug/net472/bin/System.ComponentModel.Annotations.EXE. +LOG: Attempting download of new URL file:///C:/projects/AzureFunctionsV1/bin/Debug/net472/bin/System.ComponentModel.Annotations/System.ComponentModel.Annotations.EXE. +``` + +The following exception is raised in the V2 app. +``` +System.TypeLoadException: Could not load type 'System.Security.Principal.WindowsImpersonationContext' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. + at Microsoft.AnalysisServices.AdomdClient.IdentityResolver.Dispose() + at Microsoft.AnalysisServices.AdomdClient.XmlaClient.Connect(ConnectionInfo connectionInfo, Boolean beginSession) + at Microsoft.AnalysisServices.AdomdClient.AdomdConnection.XmlaClientProvider.Connect(Boolean toIXMLA) + at Microsoft.AnalysisServices.AdomdClient.AdomdConnection.ConnectToXMLA(Boolean createSession, Boolean isHTTP) + at Microsoft.AnalysisServices.AdomdClient.AdomdConnection.Open() + at FunctionAppV2.Function1.Run(HttpRequest req, TraceWriter log) in C:\projects\FunctionAppV2\Function1.cs:line 31 +```