Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with compiling code #6

Closed
fpyir opened this issue Aug 16, 2018 · 8 comments
Closed

Error with compiling code #6

fpyir opened this issue Aug 16, 2018 · 8 comments

Comments

@fpyir
Copy link

fpyir commented Aug 16, 2018

When attempting to compile I was first greeted with the following:

Microsoft (R) Build Engine version 15.7.179.6572 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 74.92 ms for /Users/adamshort/Desktop/Code/collaboro/ice/ICE/ICE.csproj.
  ICE -> /Users/adamshort/Desktop/Code/collaboro/ice/ICE/bin/Debug/netstandard2.0/bin/ICE.dll
  No executable found matching command "dotnet-/Users/adamshort/.nuget/packages/functionmonkey.compiler/0.11.0-beta000/build/netstandard1.0/..\..\tools\netcoreapp2.0\FunctionMonkey.Compiler.dll"
/Users/adamshort/.nuget/packages/functionmonkey.compiler/0.11.0-beta000/build/netstandard1.0/FunctionMonkey.Compiler.targets(10,5): error MSB3073: The command "dotnet "/Users/adamshort/.nuget/packages/functionmonkey.compiler/0.11.0-beta000/build/netstandard1.0/..\..\tools\netcoreapp2.0\FunctionMonkey.Compiler.dll" "/Users/adamshort/Desktop/Code/collaboro/ice/ICE/bin/Debug/netstandard2.0/bin/ICE.dll"" exited with code 1. [/Users/adamshort/Desktop/Code/collaboro/ice/ICE/ICE.csproj]

Build FAILED.

/Users/adamshort/.nuget/packages/functionmonkey.compiler/0.11.0-beta000/build/netstandard1.0/FunctionMonkey.Compiler.targets(10,5): error MSB3073: The command "dotnet "/Users/adamshort/.nuget/packages/functionmonkey.compiler/0.11.0-beta000/build/netstandard1.0/..\..\tools\netcoreapp2.0\FunctionMonkey.Compiler.dll" "/Users/adamshort/Desktop/Code/collaboro/ice/ICE/bin/Debug/netstandard2.0/bin/ICE.dll"" exited with code 1. [/Users/adamshort/Desktop/Code/collaboro/ice/ICE/ICE.csproj]
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:03.83

After a bit of digging around, I found that inside of netstandard1.0/FunctionMonkey.Compiler.targets I was specifying this path with:

    <FunctionCompilerExe Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp' OR '$(TargetFrameworkIdentifier)' == '.NETStandard'">dotnet "$(MSBuildThisFileDirectory)..\..\tools\netcoreapp2.0\FunctionMonkey.Compiler.dll"</FunctionCompilerExe>

Surprisingly, the direction of those slashes was actually important - when I reversed them, I located the DLL correctly (I verified in the terminal that it was in fact at that location too)

    <FunctionCompilerExe Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp' OR '$(TargetFrameworkIdentifier)' == '.NETStandard'">dotnet "$(MSBuildThisFileDirectory)../../tools/netcoreapp2.0/FunctionMonkey.Compiler.dll"</FunctionCompilerExe>

However, this might of fixed that issue but it uncovered a much more troublesome issue that I can't fix.

Microsoft (R) Build Engine version 15.7.179.6572 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 66.52 ms for /Users/adamshort/Desktop/Code/collaboro/ice/ICE/ICE.csproj.
  ICE -> /Users/adamshort/Desktop/Code/collaboro/ice/ICE/bin/Debug/netstandard2.0/bin/ICE.dll
  
  Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
     at FunctionMonkey.ConfigurationLocator.FindConfiguration(Assembly assembly) in D:\wip\myOpenSource\functionMonkey\Source\FunctionMonkey\ConfigurationLocator.cs:line 95
     at FunctionMonkey.Compiler.Implementation.FunctionCompiler.Compile() in D:\wip\myOpenSource\functionMonkey\Source\FunctionMonkey.Compiler\Implementation\FunctionCompiler.cs:line 56
     at FunctionMonkey.Compiler.Program.Main(String[] args) in D:\wip\myOpenSource\functionMonkey\Source\FunctionMonkey.Compiler\Program.cs:line 44
  /var/folders/ws/8qmgsd2d5qzgk18kqcr5tgb80000gn/T/tmp76d75810b305435184c34e47eb5e1137.exec.cmd: line 2: 39374 Abort trap: 6           dotnet "/Users/adamshort/.nuget/packages/functionmonkey.compiler/0.11.0-beta000/build/netstandard1.0/../../tools/netcoreapp2.0/FunctionMonkey.Compiler.dll" "/Users/adamshort/Desktop/Code/collaboro/ice/ICE/bin/Debug/netstandard2.0/bin/ICE.dll"
/Users/adamshort/.nuget/packages/functionmonkey.compiler/0.11.0-beta000/build/netstandard1.0/FunctionMonkey.Compiler.targets(10,5): error MSB3073: The command "dotnet "/Users/adamshort/.nuget/packages/functionmonkey.compiler/0.11.0-beta000/build/netstandard1.0/../../tools/netcoreapp2.0/FunctionMonkey.Compiler.dll" "/Users/adamshort/Desktop/Code/collaboro/ice/ICE/bin/Debug/netstandard2.0/bin/ICE.dll"" exited with code 134. [/Users/adamshort/Desktop/Code/collaboro/ice/ICE/ICE.csproj]

Build FAILED.

/Users/adamshort/.nuget/packages/functionmonkey.compiler/0.11.0-beta000/build/netstandard1.0/FunctionMonkey.Compiler.targets(10,5): error MSB3073: The command "dotnet "/Users/adamshort/.nuget/packages/functionmonkey.compiler/0.11.0-beta000/build/netstandard1.0/../../tools/netcoreapp2.0/FunctionMonkey.Compiler.dll" "/Users/adamshort/Desktop/Code/collaboro/ice/ICE/bin/Debug/netstandard2.0/bin/ICE.dll"" exited with code 134. [/Users/adamshort/Desktop/Code/collaboro/ice/ICE/ICE.csproj]
    0 Warning(s)
    1 Error(s)

If you need any details I will happily provide. I am building a production system using this platform as I actually was going to build all of this myself before I stumbled upon the framework thanks to a tip from a mate (how lucky!!!).

Happy to help however I can! The only potential thing I can think of is that my DLL resides within netstandard2.0, while FM.Compiler seems to be in netstandard1.0?

@JamesRandall
Copy link
Owner

First - thanks for the detailed error report, I'm looking at this now. I believe I have a resolution for the path issue and the second issue is connected to some sort of assembly loading problem which is missing type information in the exception. I'll get those resolved now and while I don't think that will fix the second problem hopefully it will give us more insight.

If its still opaque at that point then I can outline how to debug FunctionMonkey (its pretty easy) and we can maybe do a screen share or share source. Whatever works best!

@fpyir
Copy link
Author

fpyir commented Aug 16, 2018

Fantastic! That would be awesome. Yeah, I am super happy to debug FM, sounds great!

JamesRandall added a commit that referenced this issue Aug 16, 2018
@JamesRandall
Copy link
Owner

A couple of new NuGet packages should be available (FunctionMonkey 0.12.1 and FunctionMonkey.Compiler 0.12.1) - could you give those a go and let me know what you find please?

The FunctionMonkeyCompilerExe property in the target file should now use / on Unix based platforms (I've not been able to try that - I do have a Mac but not with me at the moment, I've only used FunctionMonkey in "debug" mode on it so obviously this is something I need to start looking at more closely now!).

And I've put some belt and braces around the error handler for the assembly load exception. Seems its getting a null type I didn't expect.

I'm just writing up some compile and debug notes as part of the main documentation now - ought to be there anyhow.

@fpyir
Copy link
Author

fpyir commented Aug 16, 2018

Much appreciated! Getting correct error messages now, here's the output:

  Writing /var/folders/ws/8qmgsd2d5qzgk18kqcr5tgb80000gn/T/tmpYPWEuX.tmp
info : Adding PackageReference for package 'FunctionMonkey' into project '/Users/adamshort/Desktop/Code/collaboro/ice/ICE/ICE.csproj'.
log  : Restoring packages for /Users/adamshort/Desktop/Code/collaboro/ice/ICE/ICE.csproj...
info :   GET https://api.nuget.org/v3-flatcontainer/functionmonkey/index.json
info :   OK https://api.nuget.org/v3-flatcontainer/functionmonkey/index.json 1018ms
error: Unable to find package FunctionMonkey with version (>= 0.12.1)
Adams-MacBook-Pro:ICE adamshort$ dotnet build
Microsoft (R) Build Engine version 15.7.179.6572 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restoring packages for /Users/adamshort/Desktop/Code/collaboro/ice/ICE/ICE.csproj...
  Generating MSBuild file /Users/adamshort/Desktop/Code/collaboro/ice/ICE/obj/ICE.csproj.nuget.g.props.
  Restore completed in 576.64 ms for /Users/adamshort/Desktop/Code/collaboro/ice/ICE/ICE.csproj.
  ICE -> /Users/adamshort/Desktop/Code/collaboro/ice/ICE/bin/Debug/netstandard2.0/bin/ICE.dll
  
  Unhandled Exception: FunctionMonkey.TypeLoadingException: ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
  Unable to load types:
      ICE.Configuration
      ICE.Services.AzureBusBroker
      ICE.Services.AzureComputerVision
      ICE.Services.IAzureComputerVision
      ICE.Services.ILogging
      ICE.Services.IServiceBroker
      ICE.Services.IStorage
      ICE.Services.Log
      ICE.Services.Storage
      ICE.Models.Asset
      ICE.Models.CognitiveServices.AdultContent
      ICE.Models.CognitiveServices.Analysis
      ICE.Models.CognitiveServices.FaceDetails
      ICE.Models.CognitiveServices.ImageCaption
      ICE.Models.CognitiveServices.ImageCategory
      ICE.Models.CognitiveServices.ImageColoring
      ICE.Models.CognitiveServices.ImageDescription
      ICE.Models.CognitiveServices.ImageTag
      ICE.Models.CognitiveServices.Ocr
      ICE.Models.CognitiveServices.Feature
      ICE.Handlers.BasicTaggingImagesHandler
      ICE.Handlers.FaceRecognitionImagesHandler
      ICE.Handlers.MetadataHandler
      ICE.Handlers.OcrImagesHandler
      ICE.Handlers.ProcessingRequestHandler
      ICE.Commands.BasicTaggingImagesCommand
      ICE.Commands.FaceRecognitionImagesCommand
      ICE.Commands.OcrImagesCommand
      ICE.Commands.ProcessingRequestCommand
      <PrivateImplementationDetails>
      ICE.Configuration+<>c
      ICE.Services.AzureBusBroker+<SendToService>d__3
      ICE.Services.AzureComputerVision+<>c
      ICE.Services.AzureComputerVision+<OcrFor>d__11
      ICE.Services.AzureComputerVision+<CategoriesFor>d__12
      ICE.Services.AzureComputerVision+<CheckForAdultContent>d__13
      ICE.Services.AzureComputerVision+<TagsFor>d__14
      ICE.Services.AzureComputerVision+<DescriptionsFor>d__15
      ICE.Services.AzureComputerVision+<FacesIn>d__16
      ICE.Services.AzureComputerVision+<ColoringFor>d__17
      ICE.Services.AzureComputerVision+<>c__DisplayClass18_0
      ICE.Services.AzureComputerVision+<AnalyseImages>d__18
      ICE.Services.AzureComputerVision+<>c__DisplayClass19_0
      ICE.Services.AzureComputerVision+<>c__DisplayClass19_1
      ICE.Services.AzureComputerVision+<RequestAnalysis>d__19
      ICE.Services.AzureComputerVision+<>c__DisplayClass21_0
      ICE.Services.Log+<>c__DisplayClass10_0
      ICE.Services.Log+<>c
      ICE.Models.Asset+AssetType
      ICE.Models.Asset+User
      ICE.Models.Asset+AssetThumbnail
      ICE.Models.CognitiveServices.FaceDetails+FaceBox
      ICE.Models.CognitiveServices.Ocr+Region
      ICE.Models.CognitiveServices.Ocr+Line
      ICE.Models.CognitiveServices.Ocr+Word
      ICE.Models.CognitiveServices.Ocr+<>c
      ICE.Handlers.BasicTaggingImagesHandler+<ExecuteAsync>d__0
      ICE.Handlers.FaceRecognitionImagesHandler+<ExecuteAsync>d__0
      ICE.Handlers.OcrImagesHandler+<ExecuteAsync>d__0
      ICE.Handlers.ProcessingRequestHandler+<>c__DisplayClass4_0
      ICE.Handlers.ProcessingRequestHandler+<ExecuteAsync>d__4
      <PrivateImplementationDetails>+__StaticArrayInitTypeSize=12
      ICE.Models.CognitiveServices.Ocr+Line+<>c
      null type in ReflectionTypeLoadException
      null type in ReflectionTypeLoadException
      null type in ReflectionTypeLoadException
      null type in ReflectionTypeLoadException
      null type in ReflectionTypeLoadException
      null type in ReflectionTypeLoadException
      null type in ReflectionTypeLoadException
      null type in ReflectionTypeLoadException
      null type in ReflectionTypeLoadException
      null type in ReflectionTypeLoadException
  With errors:
      FileNotFoundException: Could not load file or assembly 'Microsoft.WindowsAzure.Storage, Version=9.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
  
      FileNotFoundException: Could not load file or assembly 'Microsoft.WindowsAzure.Storage, Version=9.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
  
      FileNotFoundException: Could not load file or assembly 'Microsoft.WindowsAzure.Storage, Version=9.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
  
      FileNotFoundException: Could not load file or assembly 'Microsoft.WindowsAzure.Storage, Version=9.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
  
      FileNotFoundException: Could not load file or assembly 'Microsoft.WindowsAzure.Storage, Version=9.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
  
      FileNotFoundException: Could not load file or assembly 'Microsoft.WindowsAzure.Storage, Version=9.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
  
      FileNotFoundException: Could not load file or assembly 'Microsoft.WindowsAzure.Storage, Version=9.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
  
      FileNotFoundException: Could not load file or assembly 'Microsoft.WindowsAzure.Storage, Version=9.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
  
      FileNotFoundException: Could not load file or assembly 'Microsoft.WindowsAzure.Storage, Version=9.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
  
      FileNotFoundException: Could not load file or assembly 'Microsoft.WindowsAzure.Storage, Version=9.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
  
  
     at FunctionMonkey.ConfigurationLocator.FindConfiguration(Assembly assembly) in D:\wip\myOpenSource\functionMonkey\Source\FunctionMonkey\ConfigurationLocator.cs:line 115
     at FunctionMonkey.Compiler.Implementation.FunctionCompiler.Compile() in D:\wip\myOpenSource\functionMonkey\Source\FunctionMonkey.Compiler\Implementation\FunctionCompiler.cs:line 56
     at FunctionMonkey.Compiler.Program.Main(String[] args) in D:\wip\myOpenSource\functionMonkey\Source\FunctionMonkey.Compiler\Program.cs:line 45
  /var/folders/ws/8qmgsd2d5qzgk18kqcr5tgb80000gn/T/tmp4a7068bddb4d400db7fc7ca71ea9ca51.exec.cmd: line 2: 48788 Abort trap: 6           dotnet "/Users/adamshort/.nuget/packages/functionmonkey.compiler/0.12.1-beta000/build/netstandard1.0/../../tools/netcoreapp2.0/FunctionMonkey.Compiler.dll" "/Users/adamshort/Desktop/Code/collaboro/ice/ICE/bin/Debug/netstandard2.0/bin/ICE.dll"
/Users/adamshort/.nuget/packages/functionmonkey.compiler/0.12.1-beta000/build/netstandard1.0/FunctionMonkey.Compiler.targets(11,5): error MSB3073: The command "dotnet "/Users/adamshort/.nuget/packages/functionmonkey.compiler/0.12.1-beta000/build/netstandard1.0/../../tools/netcoreapp2.0/FunctionMonkey.Compiler.dll" "/Users/adamshort/Desktop/Code/collaboro/ice/ICE/bin/Debug/netstandard2.0/bin/ICE.dll"" exited with code 134. [/Users/adamshort/Desktop/Code/collaboro/ice/ICE/ICE.csproj]

Build FAILED.

If you show me how to run FunctionMonkey in debug, I reckon I could have a solid crack at fixing this.

@fpyir
Copy link
Author

fpyir commented Aug 16, 2018

Also, I can confirm that Microsoft.WindowsAzure.Storage.dll is in fact in netstandard2.0/bin.

@JamesRandall
Copy link
Owner

Thanks!

The issue is to do with the version of the Microsoft.WindowsAzure.Storage assembly - because Azure Functions runs your code in process and how the extensions worked you had to match the specific versions of assemblies that the runtime was using. Severely limiting.

Fortunately they've been working on improving this but the Storage assembly is the last one to be addressed. There's some more info here:

Azure/Azure-Functions#821

They are literally about to roll out updates to resolve this:

Azure/app-service-announcements#129
Azure/app-service-announcements-discussions#64

In the meantime you basically need to make sure you reference (and your dependencies reference or are compatible with) 8.6.0.

As soon as the new NuGet package is released (tonight I believe) I'll update the Function Monkey assemblies to match.

If you're interested in debugging Function Monkey / working on it / exploring it I've published some guidance over here:

https://functionmonkey.azurefromthetrenches.com/guides/contributing/debugging.html

Hopefully useful!

@fpyir
Copy link
Author

fpyir commented Aug 17, 2018

Oh wow, that is some seriously convenient timing! Thank you for all your help!

Thanks for the guidance doc too, super interested in working on the framework. Cheers!

@JamesRandall
Copy link
Owner

Thanks for your help in getting to the bottom of it and feedback, much appreciated!

I'll close this now but do let me know if you have any further issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants