Coder Social home page Coder Social logo

Comments (9)

fpyir avatar fpyir commented on July 29, 2024

I have narrowed it down a bit - the error seems to appear if I use JsonProperty on an ICommand-implementing class (in my case, AddTenantToPolicyCommand.cs) as followed:

using AzureFromTheTrenches.Commanding.Abstractions;
using ICE.Models;
using Newtonsoft.Json;

namespace ICE.Commands.Policies
{
    public class AddTenantToPolicyCommand : ICommand<Policy>
    {
        [JsonProperty("name")] // Commenting this out stops the error.
        public string PolicyName { get; set; }
        
        // [JsonProperty("newTenant")]
        public int NewTenant { get; set; }
    }
}

I have a sneaking suspicion that this has something to do with the way JSON serialisation & deserialisation is done natively by FM?

from functionmonkey.

fpyir avatar fpyir commented on July 29, 2024

Or, if a command subclasses from a class with JsonProperties.

from functionmonkey.

JamesRandall avatar JamesRandall commented on July 29, 2024

Thanks for reporting it and doing all that digging around - I'll try and take a look today (I'm on UK time).

from functionmonkey.

JamesRandall avatar JamesRandall commented on July 29, 2024

Apologies - struggled to find any time the last couple of days but almost certainly will over the weekend.

from functionmonkey.

JamesRandall avatar JamesRandall commented on July 29, 2024

Could you give this a go on the latest Azure Functions runtime with Function Monkey v0.13 please and let me know how you get on?

I'm struggling to replicate it but my attempts to do so have taken place after updating Function Monkey to be compatible with the new runtime.

from functionmonkey.

fpyir avatar fpyir commented on July 29, 2024

Yep will do - currently doing some spring cleaning on the codebase but I should get around to this in 3-4hrs.

from functionmonkey.

fpyir avatar fpyir commented on July 29, 2024

I can, in fact, confirm this isn't happening anymore. Weird, perhaps due to the new AZ function runtime?

from functionmonkey.

JamesRandall avatar JamesRandall commented on July 29, 2024

Yes I think so - I'd suspected it might be. They've done a lot of work around the dependency compatibility issues caused by things being in process and packages in the core runtime in the last couple of releases and the last update made the final set of changes for v2. It was super easy to get into a pickle before.

Phew.

Thanks for reporting and working through with me, much appreciated.

from functionmonkey.

davidjsteele avatar davidjsteele commented on July 29, 2024

Hi James,
This seems to have reared its head again. Using FM 3.0.17 with Microsoft.NET.sdk.Functions 1.0.30-beta2 results in :

13>Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'. Could not find or load a specific file. (Exception from HRESULT: 0x80131621) 13> at System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type) 13> at System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) 13> at System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) 13> at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg) 13> at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes) 13> at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimePropertyInfo property, RuntimeType caType) 13> at System.Attribute.InternalGetCustomAttributes(PropertyInfo element, Type type, Boolean inherit)

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.