Git Product home page Git Product logo

Comments (12)

JamesRandall avatar JamesRandall commented on July 19, 2024 1

This should be fixed in the v0.17.x assemblies currently being indexed by NuGet. I've been able to replicate the issue and confirm it resolved but if you continue to have issues let me know and I'll reopen this.

Thanks very much for everyones help.

from functionmonkey.

JamesRandall avatar JamesRandall commented on July 19, 2024

That's an odd error. Can you share your IFunctionAppConfiguration implementation? (or better still your solution if its open source)

from functionmonkey.

ron194 avatar ron194 commented on July 19, 2024

I was just following the "get started".
And found out that my project target framework is ".Net Core v2.1"
But I have no idea how to change it to ".Net Standard".

from functionmonkey.

JamesRandall avatar JamesRandall commented on July 19, 2024

I'm not sure what's going on here as I've created a couple of new projects recently without issue.

How did you create your Function app? Visual Studio? Code? Mac or Windows?

from functionmonkey.

JamesRandall avatar JamesRandall commented on July 19, 2024

I think this might be related to this:
Azure/azure-functions-vs-build-sdk#160

from functionmonkey.

Enlatic avatar Enlatic commented on July 19, 2024

Is there a resolution for this? What I did.
Created a Function App v2 in Visual Studio 15.9.2. Added FunctionMonkey and FM.Compile .v0.16.1-beta000

Create functionsconfig from the Get Started aka HelloWorld example.
Does not compile, get the TypeLoadingException.
1>------ Rebuild All started: Project: FunctionApp1, Configuration: Debug Any CPU ------ 1>FunctionApp1 -> C:\Dev\brickwork.api\Testing\FunctionApp1\bin\Debug\netcoreapp2.1\bin\FunctionApp1.dll 1> 1>Unhandled Exception: FunctionMonkey.TypeLoadingException: ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information. 1>Unable to load types: 1> null type in ReflectionTypeLoadException 1> null type in ReflectionTypeLoadException 1> null type in ReflectionTypeLoadException 1> null type in ReflectionTypeLoadException 1>With errors: 1> FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. 1> FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. 1> FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. 1> FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. 1> 1> at FunctionMonkey.ConfigurationLocator.FindConfiguration(Assembly assembly) in C:\wip\myOpenSource\functionMonkey\Source\FunctionMonkey\ConfigurationLocator.cs:line 115 1> at FunctionMonkey.Compiler.Implementation.FunctionCompiler.Compile() in C:\wip\myOpenSource\functionMonkey\Source\FunctionMonkey.Compiler\Implementation\FunctionCompiler.cs:line 55 1> at FunctionMonkey.Compiler.Program.Main(String[] args) in C:\wip\myOpenSource\functionMonkey\Source\FunctionMonkey.Compiler\Program.cs:line 45 1>C:\Users\draft\.nuget\packages\functionmonkey.compiler\0.16.1-beta000\build\netstandard1.0\FunctionMonkey.Compiler.targets(11,5): error MSB3073: The command "dotnet "C:\Users\draft\.nuget\packages\functionmonkey.compiler\0.16.1-beta000\build\netstandard1.0\..\..\tools\netcoreapp2.0/FunctionMonkey.Compiler.dll" "C:\Dev\brickwork.api\Testing\FunctionApp1\bin\Debug\netcoreapp2.1\bin\FunctionApp1.dll"" exited with code -532462766. 1>Done building project "FunctionApp1.csproj" -- FAILED. ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

Changed the Target Framework netstandard2.0. Still compiler error.
1>------ Rebuild All started: Project: FunctionApp1, Configuration: Debug Any CPU ------ 1>FunctionApp1 -> C:\Dev\brickwork.api\Testing\FunctionApp1\bin\Debug\netstandard2.0\bin\FunctionApp1.dll 1> 1>Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object. 1> at FunctionMonkey.Compiler.HandlebarsHelpers.HttpVerbsHelper.HelperFunction(TextWriter writer, Object context, Boolean toLowerCase, Object[] parameters) in C:\wip\myOpenSource\functionMonkey\Source\FunctionMonkey.Compiler\HandlebarsHelpers\HttpVerbsHelper.cs:line 28 1> at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid5[T0,T1,T2,T3,T4](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4) 1> at FunctionMonkey.Compiler.HandlebarsHelpers.HttpVerbsHelper.<>c.<Register>b__0_1(TextWriter writer, Object context, Object[] parameters) in C:\wip\myOpenSource\functionMonkey\Source\FunctionMonkey.Compiler\HandlebarsHelpers\HttpVerbsHelper.cs:line 15 1> at lambda_method(Closure , TextWriter , Object ) 1> at HandlebarsDotNet.Handlebars.HandlebarsEnvironment.<>c__DisplayClass7_0.<Compile>b__0(Object context) 1> at FunctionMonkey.Compiler.Implementation.JsonCompiler.Compile(IReadOnlyCollection1 functionDefinitions, OpenApiOutputModel openApiOutputModel, String outputBinaryFolder, String outputNamespaceName) in C:\wip\myOpenSource\functionMonkey\Source\FunctionMonkey.Compiler\Implementation\JsonCompiler.cs:line 34
1> at FunctionMonkey.Compiler.Implementation.FunctionCompiler.Compile() in C:\wip\myOpenSource\functionMonkey\Source\FunctionMonkey.Compiler\Implementation\FunctionCompiler.cs:line 71
1> at FunctionMonkey.Compiler.Program.Main(String[] args) in C:\wip\myOpenSource\functionMonkey\Source\FunctionMonkey.Compiler\Program.cs:line 44
1>C:\Users\draft.nuget\packages\functionmonkey.compiler\0.16.1-beta000\build\netstandard1.0\FunctionMonkey.Compiler.targets(11,5): error MSB3073: The command "dotnet "C:\Users\draft.nuget\packages\functionmonkey.compiler\0.16.1-beta000\build\netstandard1.0....\tools\netcoreapp2.0/FunctionMonkey.Compiler.dll" "C:\Dev\brickwork.api\Testing\FunctionApp1\bin\Debug\netstandard2.0\bin\FunctionApp1.dll"" exited with code -1073741819.
1>Done building project "FunctionApp1.csproj" -- FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
`

And my dotnet --info

FunctionApp1>dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 2.1.500
Commit: b68b931422

Runtime Environment:
OS Name: Windows
OS Version: 10.0.17134

OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.1.500\

Host (useful for support):
Version: 2.1.6
Commit: 3f4f8eebd8

.NET Core SDKs installed:
1.0.0-preview2-003131 [C:\Program Files\dotnet\sdk]
1.0.0-preview2-003133 [C:\Program Files\dotnet\sdk]
1.0.0-preview2-1-003177 [C:\Program Files\dotnet\sdk]
2.0.2 [C:\Program Files\dotnet\sdk]
2.1.4 [C:\Program Files\dotnet\sdk]
2.1.200 [C:\Program Files\dotnet\sdk]
2.1.201 [C:\Program Files\dotnet\sdk]
2.1.202 [C:\Program Files\dotnet\sdk]
2.1.301 [C:\Program Files\dotnet\sdk]
2.1.500 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 1.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 1.1.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download

from functionmonkey.

JamesRandall avatar JamesRandall commented on July 19, 2024

I finally managed to replicate it (or something very similar to it which I think is the same underlying issue) yesterday so am currently investigating. I do have to fit it around client work but hopefully get an understanding and fix out in the next few days.

from functionmonkey.

Enlatic avatar Enlatic commented on July 19, 2024

If you need testing and/or another set of hands. I'm willing to help out, its a cool project that would save me a fair amount of coding and headache on my current project.

from functionmonkey.

JamesRandall avatar JamesRandall commented on July 19, 2024

I can definitely replicate this now.

I think its happening because the Azure Functions project now creates a .NET Core 2.1 class library rather than a .NET Standard 2.0 class library. Ironically I had to do quite a bit of work to make sure .NET Standard assemblies were built against by Roslyn rather than the .NET Core assemblies of the Function Monkey compiler (it being a .NET Core console app).

Thanks @Enlatic ! Any and all help greatly appreciated.

Will happily take PRs etc. particularly for bug fixes.

For new features I'd super appreciate a proposal / chat first, just to save any potential rework / pain for people due to other things that might be in play (I'm currently working on output triggers as time allows).

from functionmonkey.

Enlatic avatar Enlatic commented on July 19, 2024

Found out why there is a NullReferenceException after you change the project to netstandard2.0

In the Getting Started demo code.
.Functions(functions => functions .HttpRoute("/api/v1/HelloWorld", route => route .HttpFunction<HelloWorldCommand>() ) );

HttpFunction() has a tiny bug. There is a null to many when calling BuildHttpFunction.

It should default to HttpMethod.Get but it defaults to params: null, HttpMethod.Get

Changing the project to netstandard and explicitly define the HttpMethods in the config then it compiles and runs smoothly :)

from functionmonkey.

JamesRandall avatar JamesRandall commented on July 19, 2024

Thanks @Enlatic - super helpful.

I've just found that myself while working through a fix for .NET Core assemblies - will definitely get that in an update quick.

from functionmonkey.

JamesRandall avatar JamesRandall commented on July 19, 2024

I've got this targetting 2.1 properly - the "quick fix" was to just bump the FunctionCompiler assembly to 2.1 and that seemed to work but I've also updated the pathway so it will pull in 2.1 assemblies from the runtime loaded set rather than from the netstandard reference set.

I just need to update the compiler targets so that a flag is appended to the console command when targetting 2.1 to enable this path. That should mean older netstandard 2.0 targeting Function Apps will work as will newer .NET Core 2.1 targetting apps.

Eventually I can then deprecate the netstandard2.0 reference set that is carried around with the compiler and make the NuGet package a lot smaller!

I hope to release all this stuff over the weekend.

Super grateful for everyones feedback and help.

from functionmonkey.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.