Jump to content

Recommended Posts

Posted
On 10/2/2019 at 1:28 PM, bulllox said:

Yeah i build everything but thats the output i get

You are missing something else or did something wrong in the process. Try doing everything from the scratch if you still have this problem

  • 4 months later...
  • 3 months later...
  • 7 months later...
Posted

How make on a Version 1.1 DP1-2, i have a problem.

n2lNd9r.png

And I have before to compilation log in console

p0Cbtpc.png

Debug shows this Line 

using (DefaultDbContext dbContext = new DefaultDbContext())
            {
                var playerCount = dbContext.Accounts.Count();
                NAPI.Util.ConsoleOutput("Postaci w bazie danych: " + playerCount);
            }

In main.cs File

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using GTANetworkAPI;

namespace GM
{
    class main : Script
    {
        [ServerEvent(Event.ResourceStart)]
        public void OnResourceStart()
        {
            using (DefaultDbContext dbContext = new DefaultDbContext())
            {
                var playerCount = dbContext.Accounts.Count();
                NAPI.Util.ConsoleOutput("Postaci w bazie danych: " + playerCount);
            }
        }
    }
}

 

How repair this problem?

  • 1 year later...
Posted
On 2/10/2021 at 1:06 PM, Nerdzik said:

How make on a Version 1.1 DP1-2, i have a problem.

n2lNd9r.png

And I have before to compilation log in console

p0Cbtpc.png

Debug shows this Line 

using (DefaultDbContext dbContext = new DefaultDbContext())
            {
                var playerCount = dbContext.Accounts.Count();
                NAPI.Util.ConsoleOutput("Postaci w bazie danych: " + playerCount);
            }

In main.cs File

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using GTANetworkAPI;

namespace GM
{
    class main : Script
    {
        [ServerEvent(Event.ResourceStart)]
        public void OnResourceStart()
        {
            using (DefaultDbContext dbContext = new DefaultDbContext())
            {
                var playerCount = dbContext.Accounts.Count();
                NAPI.Util.ConsoleOutput("Postaci w bazie danych: " + playerCount);
            }
        }
    }
}

 

How repair this problem?

I have this same issue. Has anyone been able to fix this?

Posted (edited)
On 2/10/2021 at 1:06 PM, Nerdzik said:

How make on a Version 1.1 DP1-2, i have a problem.

n2lNd9r.png

And I have before to compilation log in console

p0Cbtpc.png

Debug shows this Line 

using (DefaultDbContext dbContext = new DefaultDbContext())
            {
                var playerCount = dbContext.Accounts.Count();
                NAPI.Util.ConsoleOutput("Postaci w bazie danych: " + playerCount);
            }

In main.cs File

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using GTANetworkAPI;

namespace GM
{
    class main : Script
    {
        [ServerEvent(Event.ResourceStart)]
        public void OnResourceStart()
        {
            using (DefaultDbContext dbContext = new DefaultDbContext())
            {
                var playerCount = dbContext.Accounts.Count();
                NAPI.Util.ConsoleOutput("Postaci w bazie danych: " + playerCount);
            }
        }
    }
}

 

How repair this problem?

-----Don't mind my previous post I just figured out how to fix this error-----

What you want to do is change your CSProj file to include these lines:

Under <PropertyGroup> put this line:

    <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>

Then in your <ItemGroup> include this line below:
    <PackageReference Include="System.Diagnostics.DiagnosticSource" Version="5.0.1" />

From here save the csproj file, right click on your solution, and rebuild. 

Before doing the next step, backup the System.Diagnostics.DiagnosticSource.dll that is in server-files/dotnet/runtime just in case this fix does not work for you. Otherwise you will have no way of knowing what version it was.

Next, navigate to server-files/dotnet/resources/yourProject/bin/Debug/netcoreapp3.1. In this folder you will find "System.Diagnostics.DiagnosticSource.dll" and you'll want to copy this file and paste it into server-files/dotnet/runtime. It will overwrite the current version of System.Diagnostics.DiagnosticSource.dll that is in server-files/dotnet/runtime and you want to do this. 

I believe the issue is occurring because the dependency in that runtime folder by default is older than the one we want to use for MySqlConnector. The author of MySqlConnector lists System.Diagnostics.DiagnosticSource.dll as the only dependency for netcoreapp3.1 so I'm guessing version was off.

UPDATE: change version="5.0.1" to version="6.0.0". I tested and version 6.0.0 works too. Due to this, I don't think it's a versioning issue, just a matter of the incorrect Diagnostics.DiagnosticSource being in the runtime folder.

Edited by TechNo.
  • 1 year later...
  • 5 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...