c# - PeachPie error when using the WPGraphQL plugin for WordPress

I am attempting to use the WPGraphQL plugin for WordPress with PeachPie. I've built it out using a Visual Studio 2019 solution with two projects based on the ASP.NET Core Empty template with the Target Framework set to .NET 5.0.
I have successfully set up an initial project that utilizes the default Nuget package, PeachPied.WordPress.AspNetCore. It runs correctly, and renders the WordPress page as expected. The project file for this first one looks like this:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="PeachPied.WordPress.AspNetCore" Version="5.7.1-preview7" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Plugins\Plugins.msbuildproj" />
</ItemGroup>
</Project>
Also, I've set up a second project under the same solution where I've loaded plugins to use with the first project. This second project is a dependency of the first one. The second project file looks like this:
<Project Sdk="PeachPied.WordPress.Build.Plugin/5.7.1-preview7">
<PropertyGroup>
<WpContentTarget>
</WpContentTarget>
<PhpRelativePath>wp-content/</PhpRelativePath>
</PropertyGroup>
</Project>
For how it looks in my solution I've included a screenshot of my Solution Explorer.
I was able to successfully test the plugin project with the HelloDolly plugin when set up the same way as this GitHub project: https://github.com/iolevel/peachpie-wordpress.
However, when trying to use the WPGraphQL plugin, I run into the following error. It shows this error when building/debugging the project.
Unable to cast object of type 'Pchp.CodeAnalysis.Semantics.BoundArrayEx' to type 'Pchp.CodeAnalysis.Semantics.BoundReferenceExpression'.
at Pchp.CodeAnalysis.Semantics.BoundListEx.<>c.<.ctor>b__22_0(KeyValuePair`2 pair)
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at System.Collections.Immutable.ImmutableArray.CreateRange[T](IEnumerable`1 items)
at System.Collections.Immutable.ImmutableArray.ToImmutableArray[TSource](IEnumerable`1 items)
at Pchp.CodeAnalysis.Semantics.BoundListEx..ctor(IEnumerable`1 items)
at Pchp.CodeAnalysis.Semantics.SemanticsBinder.BindArrayEx(ArrayEx x, BoundAccess access)
at Pchp.CodeAnalysis.Semantics.SemanticsBinder.BindExpressionCore(Expression expr, BoundAccess access)
at Pchp.CodeAnalysis.Semantics.SemanticsBinder.BindExpression(Expression expr, BoundAccess access)
at Pchp.CodeAnalysis.Semantics.SemanticsBinder.BindAssignEx(AssignEx expr, BoundAccess access)
at Pchp.CodeAnalysis.Semantics.SemanticsBinder.BindExpressionCore(Expression expr, BoundAccess access)
at Pchp.CodeAnalysis.Semantics.SemanticsBinder.BindExpression(Expression expr, BoundAccess access)
at Pchp.CodeAnalysis.Semantics.SemanticsBinder.BindStatementCore(Statement stmt)
at Pchp.CodeAnalysis.Semantics.SemanticsBinder.BindStatement(Statement stmt)
at Pchp.CodeAnalysis.Semantics.SemanticsBinder.BindWholeStatement(Statement stmt)
at Pchp.CodeAnalysis.Semantics.Graph.BuilderVisitor.VisitExpressionStmt(ExpressionStmt x)
at Devsense.PHP.Syntax.Ast.ExpressionStmt.VisitMe(TreeVisitor visitor)
at Devsense.PHP.Syntax.TreeVisitor.VisitElement(LangElement element)
at Devsense.PHP.Syntax.TreeVisitor.VisitList[T](IList`1 items)
at Pchp.CodeAnalysis.Semantics.Graph.BuilderVisitor.VisitBlockStmt(BlockStmt x)
at Devsense.PHP.Syntax.Ast.BlockStmt.VisitMe(TreeVisitor visitor)
at Devsense.PHP.Syntax.TreeVisitor.VisitElement(LangElement element)
at Pchp.CodeAnalysis.Semantics.Graph.BuilderVisitor.VisitForeachStmt(ForeachStmt x)
at Devsense.PHP.Syntax.Ast.ForeachStmt.VisitMe(TreeVisitor visitor)
at Devsense.PHP.Syntax.TreeVisitor.VisitElement(LangElement element)
at Pchp.CodeAnalysis.EnumeratorExtension.ForEach[T](IEnumerable`1 enumerable, Action`1 func)
at Pchp.CodeAnalysis.Semantics.Graph.BuilderVisitor..ctor(IList`1 statements, SemanticsBinder binder)
at Pchp.CodeAnalysis.Symbols.SourceRoutineSymbol.get_ControlFlowGraph()
at Pchp.CodeAnalysis.SourceCompiler.EnqueueRoutine(SourceRoutineSymbol routine)
at System.Threading.Tasks.Parallel.<>c__DisplayClass42_0`2.<PartitionerForEachWorker>b__1()
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)
at System.Threading.Tasks.Task.<>c__DisplayClass176_0.<ExecuteSelfReplicating>b__0(Object <p0>) Plugins C:\Users\curritl\.nuget\packages\peachpie.net.sdk\1.0.5\build\Peachpie.NET.Core.Sdk.targets 245
Answer
Solution:
It's a big in peachpie compiler itself.
https://github.com/peachpiecompiler/peachpie/issues/957
You van either delete the failing code from the php script or wait for the next release of peachpie.
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: illuminate\http\exceptions\posttoolargeexception
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.