Code Monkey home page Code Monkey logo

Comments (3)

nikcio avatar nikcio commented on September 24, 2024

Hi @rogalmic

Could you add what version of UHeadless and Umbraco CMS you experience this error on. And any reproduction steps that might be helpful debugging the issue.

from nikcio.uheadless.

rogalmic avatar rogalmic commented on September 24, 2024

Hi @nikcio

UHeadless version:

<PackageReference Include="Nikcio.UHeadless" Version="3.0.2" />

It is hard for me to create a test app reproducing this, since i added this as a test to already existing 2 language umbraco app.

The graphql will return following error for "Umbraco.BlockList" elements:

      "extensions": {
        "message": "Exception has been thrown by the target of an invocation.",
        "stackTrace": "   at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)\r\n   at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)\r\n   at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture)\r\n   at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)\r\n   at Nikcio.UHeadless.Core.Reflection.Factories.DependencyReflectorFactory.GetReflectedType[T](Type typeToReflect, Object[] constructorRequiredParamerters)\r\n   at lambda_method142(Closure , IPureResolverContext )\r\n   at HotChocolate.Execution.Processing.Tasks.ResolverTaskFactory.<ResolveAndCompleteInline>g__TryExecute|4_0(Object& result, <>c__DisplayClass4_0& )"
      }

To find the actual root cause, i created a custom PropertyMap @ PropertyMapOptions, which allowed to replace default handler with my own copy implementation of BasicBlockListModel. I found out that createPropertyValue.Culture has proper culture string, but it is not used in GetValue call "key1 is null", which results in exception from original report.

Side questions:

  • is there a way to trace also inner exceptions, since the graphql returned one does not provide useful info?
  • maybe it is possible to replace already existing entry in PropertyMap @ PropertyMapOptions, since AddEditorMapping will only add handler if umbraco type handler is not there (hence i needed to add custom AddEditorMapping implementation to register my "Umbraco.BlockList" handler in place of default one):
    public class PropertyMapExt : PropertyMap {
        public override void AddEditorMapping<TType>(string editorName)
        {
            base.types.Remove(typeof(TType));
            base.editorPropertyMap.Remove(editorName);
            base.AddEditorMapping<TType>(editorName);
            base.AddUsedType<TType>();
        }
    }

from nikcio.uheadless.

nikcio avatar nikcio commented on September 24, 2024

Hi @rogalmic,

It looks like a mistake that createPropertyValue.Culture wasn't included in the getValue call. I've included it now in v3.0.3/3.0.4 and in my testing, it doesn't make a difference for the query. But with a way to reproduce the error, I cannot be certain that the error is fixed by this change. Please try updating to the new version and see if the error is resolved.

Side questions:

Is there a way to trace also inner exceptions, since the graphql returned one does not provide useful info?

Right now there's no better way to trace the errors than in the GraphQL returned one. You're welcome to create a PR implementing some kind of logging or other way to return the errors to the developers.

A starting point might be here:

return (T?) Activator.CreateInstance(typeToReflect, injectedParamerters);

Here most errors on properties will go through I don't know if there's a great way to handle it here.

Maybe it is possible to replace already existing entry in PropertyMap @ PropertyMapOptions, since AddEditorMapping will only add handler if umbraco type handler is not there (hence i needed to add custom AddEditorMapping implementation to register my "Umbraco.BlockList" handler in place of default one):

I've fixed this in v3.0.4. Now custom mappings will overrule.

from nikcio.uheadless.

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.