Azure Functions Not Generating extensions.json - azure

I have an Azure Functions Project with multiple functions, triggered by ServiceBus and BlobStorage.
They have been building and deploying to azure fine for a couple months now.
Something happened recently and they are no longer deploying from my build machine with an error in Azure when you click on the function Error: The binding type(s) 'blobTrigger' are not registered.
It is still deploying fine from my dev machine though. They are using WEBSITE_RUN_FROM_ZIP to deploy the code itself.
I pulled the publish directory from both my dev machine and the build machine and it appears that the file extensions.json is getting generated locally but is not on the build machine, along with empty localization folders that don't exist on the build machine and about 10mb difference in size that I can't account for yet.
The Azure Functions are targeting .Net Standard 2.0. Checking the .Net versions, .Net core is the same version across the build and dev machines.
What causes this file to get generated?

One of the possible reasons could be an update to Azure Functions v2.0
That could explain sudden change causing errors for functions that as you mention were working till a couple of months ago.
Take a look at this issue
https://github.com/Azure/azure-functions-host/issues/3363#issuecomment-417926456
it's very similar to yours.
One of the changes in v2.0 is that you need to reference the storage extensions when working with storage related triggers
Reference the Storage Extension where appropriate If you have functions that work with Azure Storage (queue/tables/blob) either with
triggers, input bindings or output bindings, you'll need to reference
the new Microsoft.Azure.WebJobs.Extensions.Storage extension.
Here is a link that documents all the breaking changes -
Azure Functions Runtime 2.0.12050-alpha breaking changes notice

I have been able to work around the issue by following the advice in this Github comment.
Essentially sometimes you have to include an extra dependency to get msbuild/visual studio to run the post build steps and generate your extensions file.
Add Microsoft.Azure.Webjobs.Script.ExtensionsMetadataGenerator as a dependency to your functions project and it should always (so far) build your publish directory properly.
Per usual, leaving the question open for someone to tell us why this is needed.

The best way to find out why it is not working is to turn on the diagnostic logs in Visual Studio then build.
Then, after you build, you can search for the word "extensions.json"
Which will start like this:
2> Task "GenerateFunctionsExtensionsMetadata"
2> Task Parameter:SourcePath=F:\git\clients\hbti\Portal\hbti-web-master\HBTI.ServiceTech.AzureFunctions\bin\Debug\netcoreapp3.1\bin
2> Task Parameter:OutputPath=F:\git\clients\hbti\Portal\hbti-web-master\HBTI.ServiceTech.AzureFunctions\bin\Debug\netcoreapp3.1\bin
2> Extensions generator working directory: 'C:\Users\jsgou\.nuget\packages\microsoft.azure.webjobs.script.extensionsmetadatagenerator\1.1.8\tools\net46\..\netstandard2.0\generator'
2> Extensions generator path: 'dotnet'
2> Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.Console.dll "F:\git\clients\hbti\Portal\hbti-web-master\HBTI.ServiceTech.AzureFunctions\bin\Debug\netcoreapp3.1\bin" "F:\git\clients\hbti\Portal\hbti-web-master\HBTI.ServiceTech.AzureFunctions\bin\Debug\netcoreapp3.1\bin\extensions.json"
Then, a little further you might find the actual error why it is not working:
2> HBTI.ServiceTech.AzureFunctions.dll
2> Resolving assembly: 'System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
2> Assembly 'System.Runtime' loaded.
2> Resolving assembly: 'Microsoft.Azure.Functions.Extensions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=f655f4c90a0eae19'
2> Assembly 'Microsoft.Azure.Functions.Extensions' loaded from 'F:\git\clients\hbti\Portal\hbti-web-master\HBTI.ServiceTech.AzureFunctions\bin\Debug\netcoreapp3.1\bin\Microsoft.Azure.Functions.Extensions.dll'.
2> Resolving assembly: 'Microsoft.Azure.WebJobs.Host, Version=3.0.18.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
2> Assembly 'Microsoft.Azure.WebJobs.Host' loaded from 'F:\git\clients\hbti\Portal\hbti-web-master\HBTI.ServiceTech.AzureFunctions\bin\Debug\netcoreapp3.1\bin\Microsoft.Azure.WebJobs.Host.dll'.
2> Resolving assembly: 'Microsoft.AspNetCore.Mvc.Core, Version=3.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'
2> Resolving assembly: 'Microsoft.AspNetCore.Mvc.Core, Culture=neutral, PublicKeyToken=null'
2> Cannot load 'Microsoft.AspNetCore.Mvc.Core'. Aborting assembly resolution.
2> Unable to find fallback for assembly 'Microsoft.AspNetCore.Mvc.Core'. System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.AspNetCore.Mvc.Core, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
2> File name: 'Microsoft.AspNetCore.Mvc.Core, Culture=neutral, PublicKeyToken=null'
2> at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, IntPtr ptrLoadContextBinder)
2> at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, IntPtr ptrLoadContextBinder)
2> at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, StackCrawlMark& stackMark, IntPtr pPrivHostBinder)
2> at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, StackCrawlMark& stackMark)
2> at System.Reflection.Assembly.Load(String assemblyString)
2> at ExtensionsMetadataGenerator.Console.Program.AssemblyLoader.<>c__DisplayClass1_0.<Initialize>b__0(Object sender, ResolveEventArgs args) in d:\a\1\s\tools\ExtensionsMetadataGenerator\src\ExtensionsMetadataGenerator.Console\Program.cs:line 78
2>
2>
2> Could not evaluate 'HBTI.ServiceTech.AzureFunctions.dll' for extension metadata. If this assembly contains a Functions extension, ensure that all dependent assemblies exist in 'F:\git\clients\hbti\Portal\hbti-web-master\HBTI.ServiceTech.AzureFunctions\bin\Debug\netcoreapp3.1\bin'. If this assembly does not contain any Functions extensions, this message can be ignored. Exception message: Could not load file or assembly 'Microsoft.AspNetCore.Mvc.Core, Version=3.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
My solution in this case, is to simply make my own extensions.json and drop it in the bin foler as such:

Related

issues after updating to Xamarin Studio

Could not register the assembly
Error messages that I am getting:
'MonoTouch.Dialog-1': MonoTouch.MonoTouchException: Cannot register two managed types('MonoTouch.Dialog.BaseBooleanImageElement+TextWithImageCellView, MonoTouch.Dialog-1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065'
and
'MonoTouch.Dialog.BaseBooleanImageElement+TextWithImageCellView, xxxxx1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null') with the same native name('MonoTouch_Dialog_BaseBooleanImageElement_TextWithImageCellView').
tried with mtouch arguments --registrar:legacy, not able fix the issue.
You've included both MonoTouch.Dialog-1.dll and MonoTouch.Dialog.dll in your app. Choose one.

Is there a build issue in the recent versions of ServiceStack 3?

I have had the following warning show up in visual studio when compiling a project using ServiceStack 3.9.71.0 (seems to affect most recent releases too). Not sure why it hasn't shown up before but it has started showing up after I created a test lib which references my main project and both have references to the same service stack DLLs:
Warning 2 Found conflicts between different versions of the same
dependent assembly that could not be resolved. These reference
conflicts are listed in the build log when log verbosity is set to
detailed. C:\Program Files
(x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets 1635
Inspecting the build log shows:
10> There was a conflict between "ServiceStack.Interfaces,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" and
"ServiceStack.Interfaces, Version=3.9.60.0, Culture=neutral,
PublicKeyToken=null". 10> "ServiceStack.Interfaces,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" was chosen
because it was primary and "ServiceStack.Interfaces, Version=3.9.60.0,
Culture=neutral, PublicKeyToken=null" was not. 10> References
which depend on "ServiceStack.Interfaces, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null"
[C:\proj\packages\ServiceStack.Common.3.9.71\lib\net35\ServiceStack.Interfaces.dll] ...
This error is correct as it seems an older version of ServiceStack.Interfaces is referenced (http://i.imgur.com/4vw3069.jpg) by the latest releases in NuGet in addition to an old version of ORMLite. I have removed all previous versions of ServiceStack from my system so its not picking up any old DLLs. My projects just have references to ServiceStack, common, interfaces and text; I removed ORM as I do not use it but adding it to both projects did not help.
A little unsure how I can resolve this error as Github does not seem to have been updated since 3.9.60, any ideas?
This is just a warning, it should build, and can safely be ignored. The error message does indicate that the build system correctly chose v1.0.0.0.
"ServiceStack.Interfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" was chosen
The version was intentionally reset from 3.9 to 1.0, about 4 months ago in this commit. This coincides with the beta release of ServiceStack v4. Presumably the v3 assembly versions where reset to a low number to allow for future BSD builds to be created without encroaching on the v4 version numbering, and to denote the clear change of project ownership.

Could not compute a complete dependency map for the project

i would like to get rid of this message so build time dramatically decreases (it builds and runs ok).
This warning appears in mtouch.
warning MT3006: Could not compute a complete dependency map for the
project. This will result in slower build times because Xamarin.iOS
can't properly detect what needs to be rebuilt (and what does not need
to be rebuilt). Please review previous warnings for more details.
Test solution: helloworld mvvmcross solution with ios project and pcl (wp8+monotouch+net45+android) + Microsoft HTTP PCL package in pcl only + an async call to HttpClient.GetStringAsync in the pcl.
Full log:
warning MT3005: The dependency 'System.Windows, Version=2.0.5.0,
Culture=neutral, PublicKeyToken=7cec85d7bea7798e' of the assembly
'Cirrious.CrossCore, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=e16445fd9b451819' was not found. Please review the
project's references.
warning MT3005: The dependency 'System.Windows, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' of the assembly
'Cirrious.MvvmCross, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=e16445fd9b451819' was not found. Please review the
project's references.
warning MT3005: The dependency 'System.Windows, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' of the assembly
'Cirrious.MvvmCross.Binding, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null' was not found. Please review the project's
references.
warning MT3005: The dependency 'System.Net.Primitives, Version=3.9.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' of
the assembly 'Com.Catenum.Intouch.Business, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null' was not found. Please review the
project's references.
warning MT3005: The dependency 'System.Net.Http, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' of the assembly
'Com.Catenum.Intouch.Business, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null' was not found. Please review the project's
references.
warning MT3005: The dependency 'System.Threading.Tasks, Version=1.5.11.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' of
the assembly 'Com.Catenum.Intouch.Business, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null' was not found. Please review the
project's references.
warning MT3006: Could not compute a complete dependency map for the project. This will result in slower build times because
Xamarin.iOS can't properly detect what needs to be rebuilt (and what
does not need to be rebuilt). Please review previous warnings for more
details.
You must make sure that all the assemblies only reference BCL assemblies that Xamarin.iOS ships.
For example:
warning MT3005: The dependency 'System.Net.Http, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' of the assembly 'Com.Catenum.Intouch.Business, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' was not found. Please review the project's references.
Xamarin.iOS does not have a System.Net.Http v1.5.0.0, it has v2.0.5.0 instead (all the Xamarin.iOS base class libraries have version v2.0.5.0, except monotouch.dll itself). The solution is to recompile Com.Catenum.Intouch.Business as a Xamarin.iOS class library (this typically involves creating a new Xamarin.iOS class library project, and link the source files in), which will ensure it contains the correct reference to System.Net.Http.dll.
Note that in Xamarin.iOS 7.0.4 there is a (harmless) bug which causes spurious MT3005/3006 warnings in some cases. This is probably the case for the first warning:
warning MT3005: The dependency 'System.Windows, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' of the assembly 'Cirrious.CrossCore, Version=1.0.0.0, Culture=neutral, PublicKeyToken=e16445fd9b451819' was not found. Please review the project's references.
since Xamarin.iOS does contain a System.Windows assembly with that version.

The dependency ''mscorlib, Version=2.0.0.0,...' was not found

i get the following error by compiling my project:
warning MT3005: The dependency 'mscorlib, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089' of the assembly
'ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral,
PublicKeyToken=null' was not found. Please review the project's
references.
warning MT3005: The dependency 'System, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089' of the assembly
'ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral,
PublicKeyToken=null' was not found. Please review the project's
references.
warning MT3006: Could not compute a complete dependency map for the
project. This will result in slower build times because Xamarin.iOS
can't properly detect what needs to be rebuilt (and what does not need
to be rebuilt). Please review previous warnings for more details.
I've found out that the System dependency of my project uses the version 2.0.5.0 and the ZipSharp uses 2.0.0.0
What should I do?
To fix the warnings you need to get (or build from sources) a version of ZipSharp that is compiled against the BCL (mscorlib.dll, System.dll) that is shipped with Xamarin.iOS (i.e. 2.0.5.0).
Note that those are warnings, not errors, so it might work.

Reactive (Rx) build issue with .Net 4.5 and NuGet

This has caused me quite the embaressment today. While I was demoing Rx 2.x features and capabilities, I tried to build a NuGet enabled project which I copied from another computer.
Everything was downloaded correctly, the references are there! but I can't compile.
These two below assemblies are causing the issue. I am wondering if anyone has faced this issue with restroing Rx assemblies into a .Net 4.5 project.
System.Reactive.Windows.Threading
Warning 11 The primary reference "System.Reactive.Windows.Threading,
Version=2.1.30214.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35,
processorArchitecture=MSIL" could not be resolved because it has an
indirect dependency on the framework assembly "System.Threading.Tasks,
Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
which could not be resolved in the currently targeted framework.
".NETFramework,Version=v4.5". To resolve this problem, either remove
the reference "System.Reactive.Windows.Threading, Version=2.1.30214.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35,
processorArchitecture=MSIL" or retarget your application to a
framework version which contains "System.Threading.Tasks,
Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
And System.Reactive.PlatformServices
Warning 26 The primary reference "System.Reactive.PlatformServices"
could not be resolved because it has an indirect dependency on the
framework assembly "System.Runtime.Extensions, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which could not be
resolved in the currently targeted framework.
".NETFramework,Version=v4.5". To resolve this problem, either remove
the reference "System.Reactive.PlatformServices" or retarget your
application to a framework version which contains
"System.Runtime.Extensions, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a".
Couldn't compile:
Error 73 The type or namespace name 'IScheduler' could not be found
(are you missing a using directive or an assembly
reference?)
Error 74 The type or namespace name 'CompositeDisposable' could not be
found (are you missing a using directive or an assembly
reference?)
My psychic debugger says this has something to do with either mixing references to .NET 4.0 and .NET 4.5 Rx DLLs in a project, or Microsoft.Bcl.Async.

Resources