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

Could not load type 'ThrowHandler' when referencing Peachpie.Library.PDO.PgSQL version 1.0.0-dev #1082

Closed
kripper opened this issue Nov 16, 2022 · 3 comments

Comments

@kripper
Copy link
Contributor

kripper commented Nov 16, 2022

I'm getting the error Could not load type 'ThrowHandler' when trying to reference Peachpie.Library.PDO.PgSQL version 1.0.0-dev (compiled using latest upstream version):

Unhandled exception. System.TypeLoadException: Could not load type 'ThrowHandler' from assembly 'Peachpie.Runtime, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5b4bee2bf1f98593'.
   at Peachpie.AspNetCore.Web.PhpHandlerMiddleware.ConfigureLogger(IPhpOptions options, ILoggerFactory factory)
   at Peachpie.AspNetCore.Web.PhpHandlerMiddleware..ctor(RequestDelegate next, IWebHostEnvironment hostingEnv, IServiceProvider services, PhpHandlerConfiguration configuration)
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Microsoft.Extensions.Internal.ActivatorUtilities.ConstructorMatcher.CreateInstance(IServiceProvider provider)
   at Microsoft.Extensions.Internal.ActivatorUtilities.CreateInstance(IServiceProvider provider, Type instanceType, Object[] parameters)
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass5_0.<UseMiddleware>b__0(RequestDelegate next)
   at Microsoft.AspNetCore.Builder.ApplicationBuilder.Build()
   at Microsoft.AspNetCore.Hosting.WebHost.BuildApplication()
   at Microsoft.AspNetCore.Hosting.WebHost.StartAsync(CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token, String startupMessage)
   at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token, String startupMessage)
   at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token)
   at Microsoft.AspNetCore.Hosting.WebHostExtensions.Run(IWebHost host)
   at (my code)

Is it broken or am I doing something wrong?

This are my build files:

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net5.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Peachpie.AspNetCore.Web" Version="1.0.0-dev" />
    <ProjectReference Include="..\Website\Website.msbuildproj" />
  </ItemGroup>

</Project>
<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net5.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <ProjectReference Include="..\Website\Website.msbuildproj" />
    <!--
    <PackageReference Include="Peachpie.AspNetCore.Web" Version="1.0.6" />
    <PackageReference Include="Peachpie.Library.PDO.PgSQL" Version="1.0.6" />
    -->
    <PackageReference Include="Peachpie.AspNetCore.Web" Version="1.0.0-dev" />
    <PackageReference Include="Peachpie.Library.PDO.PgSQL" Version="1.0.0-dev" /> <----- fails
  </ItemGroup>

</Project>
@kripper
Copy link
Contributor Author

kripper commented Nov 16, 2022

Maybe realted with a version mismatch?

warning NU1603: Server depends on Peachpie.Library.PDO.PgSQL (>= 1.0.0-dev) but Peachpie.Library.PDO.PgSQL 1.0.0-dev was not found. An approximate best match of Peachpie.Library.PDO.PgSQL 1.0.0-preview1 was resolved.

@kripper
Copy link
Contributor Author

kripper commented Nov 16, 2022

It was a version mismatch, because it works fine when referencing latest nuget:

<PackageReference Include="Peachpie.Library.PDO.PgSQL" Version="1.2.0-r14819" />

I added Peachpie.Library.PDO.PgSQL to build\update-cache.ps1 but it's still not using my local compiled assemblies.

@kripper
Copy link
Contributor Author

kripper commented Nov 16, 2022

Fixed here: #1066

@kripper kripper closed this as completed Nov 16, 2022
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

1 participant