FunctionMonkey icon indicating copy to clipboard operation
FunctionMonkey copied to clipboard

Various Compiler issues

Open alexeymarkov opened this issue 5 years ago • 1 comments

Hello,

first of all thank you for the great framework!

I found some inconvenient issues (correct me, if I am wrong and this is by design unsupported).

  1. If I try to use .AddOpenIdConnectTokenValidator(Environment.GetEnvironmentVariable("Authority"), "myapi") the compilation fails with _Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object. at FunctionMonkey.TokenValidator.Implementation.TokenValidatorConfiguration..ctor(String wellKnownEndpoint, String audience, Func 3 tokenValidationParameterFunc) at FunctionMonkey.TokenValidator.IAuthorizationBuilderExtensions.AddOpenIdConnectTokenValidator(IAuthorizationBuilder builder, String wellKnownEndpoint, String audience, Func 3 tokenValidationParameterFunc, String header)

The workaround is to use a custom ITokenValidator implementation which takes IOptions<MyOptions> via DI.

  1. Using any class in FunctionAppConfiguration from another assembly (RootNamespace.HelperAssembly) with a namespace with the same root as the function assembly (RootNamespace.FunctionAssembly) produces Unhandled Exception: FunctionMonkey.ConfigurationException: CS0234:The type or namespace name "ReferenceLinkBackAttribute" is not found in the namespace "RootNamespace.HelperAssembly". at FunctionMonkey.Compiler.Implementation.AssemblyCompiler.CompileAssembly(IReadOnlyCollection`1 syntaxTrees, IReadOnlyCollection 1 externalAssemblyLocations, OpenApiOutputModel openApiOutputModel, String outputBinaryFolder, String outputAssemblyName, String assemblyNamespace, TargetEnum target) at FunctionMonkey.Compiler.Implementation.FunctionCompiler.Compile() in /Users/jamesrandall/code/myOpenSource/functionMonkeyMaster/Source/FunctionMonkey.Compiler/Implementation/FunctionCompiler.cs:line 86 at FunctionMonkey.Compiler.Program.Main(String[] args) in /Users/jamesrandall/code/myOpenSource/functionMonkeyMaster/Source/FunctionMonkey.Compiler/Program.cs:line 47

The workaround is to use another namespace root name.

alexeymarkov avatar Oct 15 '19 08:10 alexeymarkov

Thanks - I'll get that fixed.

JamesRandall avatar Oct 16 '19 07:10 JamesRandall