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

Openmod Entity Framework could Could not set up parent class #813

Closed
Yannnyan opened this issue Mar 19, 2024 · 5 comments
Closed

Openmod Entity Framework could Could not set up parent class #813

Yannnyan opened this issue Mar 19, 2024 · 5 comments

Comments

@Yannnyan
Copy link

Yannnyan commented Mar 19, 2024

I was following up on the guide here https://openmod.github.io/openmod-docs/devdoc/concepts/databases.html, i've tried
deploying the plugin and loading the plugin, yet i've gotten a runtime exception that 'Could not resolve the signature of a virtual method assembly '. Can someone help?

[15:11:55 ERR][OpenMod.Core.Eventing.EventBus] Exception occured during event UnturnedPlayerConnected
System.TypeLoadException: Could not set up parent class, due to: Could not resolve the signature of a virtual method assembly:data-00000223E9351C30 type:RelationalOptionsExtension member:(null)
at OpenMod.EntityFrameworkCore.MySql.Configurator.MySqlDbContextConfigurator.Configure[TDbContext] (OpenMod.EntityFrameworkCore.OpenModDbContext1[TSelf] dbContext, Microsoft.EntityFrameworkCore.DbContextOptionsBuilder optionsBuilder) [0x0004c] in /_/framework/OpenMod.EntityFrameworkCore.MySql/Configurator/MySqlDbContextConfigurator.cs:31 at OpenMod.EntityFrameworkCore.Configurator.DbContextConfiguratorCompilation+<>c__DisplayClass2_01[TDbContext].b__0 (OpenMod.EntityFrameworkCore.Configurator.IDbContextConfigurator x) [0x00000] in //framework/OpenMod.EntityFrameworkCore/Configurator/DbContextConfiguratorCompilation.cs:19
at MoreLinq.MoreEnumerable.ForEach[T] (System.Collections.Generic.IEnumerable1[T] source, System.Action1[T] action) [0x0002c] in /
/MoreLinq/ForEach.cs:38
at OpenMod.EntityFrameworkCore.Configurator.DbContextConfiguratorCompilation.Configure[TDbContext] (OpenMod.EntityFrameworkCore.OpenModDbContext1[TSelf] dbContext, Microsoft.EntityFrameworkCore.DbContextOptionsBuilder optionsBuilder) [0x00014] in /_/framework/OpenMod.EntityFrameworkCore/Configurator/DbContextConfiguratorCompilation.cs:19 at OpenMod.EntityFrameworkCore.OpenModDbContext1[TSelf].OnConfiguring (Microsoft.EntityFrameworkCore.DbContextOptionsBuilder optionsBuilder) [0x00007] in //framework/OpenMod.EntityFrameworkCore/OpenModDbContext.cs:29
at Microsoft.EntityFrameworkCore.DbContext.get_InternalServiceProvider () [0x00041] in <25b3d70e4fdd45f7a2d848578491534a>:0
at Microsoft.EntityFrameworkCore.DbContext.get_DbContextDependencies () [0x00010] in <25b3d70e4fdd45f7a2d848578491534a>:0
at Microsoft.EntityFrameworkCore.DbContext.Set[TEntity] () [0x00000] in <25b3d70e4fdd45f7a2d848578491534a>:0
at ScoreBoardPlugin.Db.Contexts.PlayerConnectionContext.get_UserConnectSet () [0x00000] in <09382a155d4347e2b97b6fad0787b06b>:0
at ScoreBoardPlugin.Events.UserLoginListener.HandleEventAsync (System.Object sender, OpenMod.Unturned.Players.Connections.Events.UnturnedPlayerConnectedEvent event) [0x0007c] in <09382a155d4347e2b97b6fad0787b06b>:0
at OpenMod.Core.Eventing.EventBus.EmitAsync (OpenMod.API.IOpenModComponent component, System.Object sender, OpenMod.API.Eventing.IEvent event, OpenMod.API.Eventing.EventExecutedCallback callback) [0x0035a] in /
/framework/OpenMod.Core/Eventing/EventBus.cs:377

This is what my csproj looks like, and my target framework is netstandard2.1, i tried using netstandard 2.0, and net461

  <PropertyGroup>
    <LangVersion>9.0</LangVersion>
    <Nullable>enable</Nullable>
		<WarningsAsErrors>nullable</WarningsAsErrors>
		<NoWarn>$(NoWarn);NU1701;NU1702;CS0436</NoWarn>
  </PropertyGroup>

  <PropertyGroup>
    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
    <GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
  </PropertyGroup>

  <ItemGroup>
    <!-- <PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.19" /> -->
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.23">
			<PrivateAssets>all</PrivateAssets>
			<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
		</PackageReference>
		<!-- <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="3.1.19" /> -->
		<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies.net461" Version="1.0.3">
			<PrivateAssets>all</PrivateAssets>
			<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
		</PackageReference>

    <PackageReference Include="Hashicorp.Vault" Version="0.2.0" />

    <PackageReference Include="morelinq" Version="4.1.0" />
    <PackageReference Include="OpenMod.Unturned" Version="3.7.4+6bfe3e6f" />
      <PackageReference Include="OpenMod.Unturned.Redist" Version="3.23.12.3" />

    <PackageReference Include="OpenMod.EntityFrameworkCore" Version="3.7.4+6bfe3e6f" />
    <PackageReference Include="OpenMod.EntityFrameworkCore.MySql" Version="3.7.4+6bfe3e6f" />

    <PackageReference Include="OpenMod.Extensions.Economy.Abstractions" Version="3.7.4+6bfe3e6f" />
		<PackageReference Include="OpenMod.Extensions.Games.Abstractions" Version="3.7.4+6bfe3e6f" />
  </ItemGroup>
  
  <ItemGroup>
    <EmbeddedResource Include="config.yaml" />
    <EmbeddedResource Include="translations.yaml" />
  </ItemGroup>
@Yannnyan Yannnyan changed the title Openmod Entity Framework assymbly could not be found Openmod Entity Framework could Could not set up parent class Mar 19, 2024
@rube200
Copy link
Contributor

rube200 commented Mar 19, 2024

Not sure but I think it's because you setup to use Microsoft.EntityFrameworkCore.Tools with a diff version than om.
Also is there anything else on logs?

@Yannnyan
Copy link
Author

I've tried resetting the server, reloaded the plugin with the right version Microsoft.EntityFrameworkCore.Tool for and got this msg
Could not load signature of Microsoft.EntityFrameworkCore.Infrastructure.RelationalOptionsExtension:ApplyServices due to: Could not load file or assembly 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=3.1.19.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies.

@Yannnyan
Copy link
Author

Could not load signature of Microsoft.EntityFrameworkCore.Infrastructure.RelationalOptionsExtension:ApplyServices due to: Could not load file or assembly 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=3.1.19.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies.
[21:11:30 ERR][OpenMod.Core.Eventing.EventBus] Exception occured during event UnturnedPlayerConnected
System.TypeLoadException: Could not set up parent class, due to: Could not resolve the signature of a virtual method assembly:data-000001B6F52D7D50 type:RelationalOptionsExtension member:(null)
at OpenMod.EntityFrameworkCore.MySql.Configurator.MySqlDbContextConfigurator.Configure[TDbContext] (OpenMod.EntityFrameworkCore.OpenModDbContext1[TSelf] dbContext, Microsoft.EntityFrameworkCore.DbContextOptionsBuilder optionsBuilder) [0x0004c] in /_/framework/OpenMod.EntityFrameworkCore.MySql/Configurator/MySqlDbContextConfigurator.cs:31 at OpenMod.EntityFrameworkCore.Configurator.DbContextConfiguratorCompilation+<>c__DisplayClass2_01[TDbContext].b__0 (OpenMod.EntityFrameworkCore.Configurator.IDbContextConfigurator x) [0x00000] in //framework/OpenMod.EntityFrameworkCore/Configurator/DbContextConfiguratorCompilation.cs:19
at MoreLinq.MoreEnumerable.ForEach[T] (System.Collections.Generic.IEnumerable1[T] source, System.Action1[T] action) [0x0002c] in /
/MoreLinq/ForEach.cs:38
at OpenMod.EntityFrameworkCore.Configurator.DbContextConfiguratorCompilation.Configure[TDbContext] (OpenMod.EntityFrameworkCore.OpenModDbContext1[TSelf] dbContext, Microsoft.EntityFrameworkCore.DbContextOptionsBuilder optionsBuilder) [0x00014] in /_/framework/OpenMod.EntityFrameworkCore/Configurator/DbContextConfiguratorCompilation.cs:19 at OpenMod.EntityFrameworkCore.OpenModDbContext1[TSelf].OnConfiguring (Microsoft.EntityFrameworkCore.DbContextOptionsBuilder optionsBuilder) [0x00007] in //framework/OpenMod.EntityFrameworkCore/OpenModDbContext.cs:29
at Microsoft.EntityFrameworkCore.DbContext.get_InternalServiceProvider () [0x00041] in <25b3d70e4fdd45f7a2d848578491534a>:0
at Microsoft.EntityFrameworkCore.DbContext.get_DbContextDependencies () [0x00010] in <25b3d70e4fdd45f7a2d848578491534a>:0
at Microsoft.EntityFrameworkCore.DbContext.Set[TEntity] () [0x00000] in <25b3d70e4fdd45f7a2d848578491534a>:0
at SBP.Db.Contexts.PlayerConnectionContext.get_UserConnectSet () [0x00000] in :0
at SBP.Events.UserLoginListener.HandleEventAsync (System.Object sender, OpenMod.Unturned.Players.Connections.Events.UnturnedPlayerConnectedEvent event) [0x0007c] in :0
at OpenMod.Core.Eventing.EventBus.EmitAsync (OpenMod.API.IOpenModComponent component, System.Object sender, OpenMod.API.Eventing.IEvent event, OpenMod.API.Eventing.EventExecutedCallback callback) [0x0035a] in /
/framework/OpenMod.Core/Eventing/EventBus.cs:377

@rube200
Copy link
Contributor

rube200 commented Mar 20, 2024

What about
om remove Microsoft.EntityFrameworkCore.Tool
om install Microsoft.EntityFrameworkCore.Tool@3.1.19

@Yannnyan
Copy link
Author

It seems to be fixed after some time that I havent touched it, I've commented out this line
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.32">
Thanks for helping!

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