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

Type error when using HotChocolate 13.5 preview #13

Closed
hahn-kev opened this issue Aug 21, 2023 · 4 comments
Closed

Type error when using HotChocolate 13.5 preview #13

hahn-kev opened this issue Aug 21, 2023 · 4 comments

Comments

@hahn-kev
Copy link

I'm getting this error when using this package 4.0.2 with HotChocolate 13.5

      ResolverError: Unexpected Execution Error
      System.TypeLoadException: Could not load type 'HotChocolate.Execution.PathFactory' from assembly 'HotChocolate.Abstractions, Version=13.5.0.0, Culture=neutral, PublicKeyToken=null'.
         at DataAnnotatedModelValidations.ValidatorMiddleware.GenerateArgumentPath(String name, String memberName, List`1 contextPath, Nullable`1 valueValidation)    
         at DataAnnotatedModelValidations.ValidatorMiddleware.ReportError(IMiddlewareContext context, IInputField argument, List`1 contextPathList, Nullable`1 valueValidation, String message, String memberName)
         at DataAnnotatedModelValidations.ValidatorMiddleware.<>c__DisplayClass6_0.<ReportErrorFactory>b__0(IInputField argument)
         at System.Linq.Parallel.ForAllOperator`1.ForAllEnumerator`1.MoveNext(TInput& currentElement, Int32& currentKey)
         at System.Linq.Parallel.ForAllSpoolingTask`2.SpoolingWork()
         at System.Linq.Parallel.SpoolingTaskBase.Work()
         at System.Linq.Parallel.QueryTask.BaseWork(Object unused)
         at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
      --- End of stack trace from previous location ---
         at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
         at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)

the reason for this is because PathFactory was removed in 13.5 here. It looks like the replacement is to use Path.Root.Append.

I'd be happy to implement the fix, but I'm not sure how to make it backwards compatible with older versions of HotChocolate and this new version that they're working on. Maybe we implement classes for both and pick an implementation based on which version of HotChocolate is loaded at runtime?

@fiakkasa
Copy link
Owner

Hi,

Thanks for getting in touch and bringing this to my attention.

I propose, to release a new version 4.1.0 that would take HC 13.5 as the minimum version with the suggested change as this appears to be a change in the HC API surface.

This way pre HC 13.5 can still use the 4.0.x packages while HC 13.5 and onwards can use the 4.1.x packages.

Wdyt?

If this is not a pressing matter, I will be able to release a new version on Thursday.

Adam

@fiakkasa
Copy link
Owner

Hi,

Version 4.1.0 was released with the mitigation discussed in place.

Please find at https://www.nuget.org/packages/DataAnnotatedModelValidations/4.1.0

Adam

@hahn-kev
Copy link
Author

Awesome thank you, the new version works great for me!

@fiakkasa
Copy link
Owner

Thank you for your feedback and input!

Adam

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