logo
down
shadow

EF Core Add-Migration fails with System.TypeLoadException


EF Core Add-Migration fails with System.TypeLoadException

By : Mikail Genç
Date : October 18 2020, 01:08 AM
I think the issue was by ths following , After a lot of digging and submitting an issue to the EntityFrameworkCore GitHub page. It appears that this is an issue with the EF Core 2.0 itself. They are aware of that and it has been addressed in future releases.
There is a somehow workaround that you can find it in the following link:- GitHub EF Core
code :


Share : facebook icon twitter icon
System.TypeLoadException referencing .NET 1.0 assemblies after .NET 4.0 migration

System.TypeLoadException referencing .NET 1.0 assemblies after .NET 4.0 migration


By : JoeB
Date : March 29 2020, 07:55 AM
I wish did fix the issue. If the circumstances are rough, then I can play rough too.
If we take a look at the actual error message, it's complaining about a "static or non-public" field in the "structure". The so called structure is actually an enum. Seemingly a wrapper enum on the COM layer. There are more dozens of various wrapper enums, each value is specified explicitly. Each of the enums also contain one private int variable named "value__". More specifically it looks like this: .field private specialname rtspecialname int32 value__
'System.TypeLoadException' occurred in > Microsoft.AspNet.Mvc.Core.dll

'System.TypeLoadException' occurred in > Microsoft.AspNet.Mvc.Core.dll


By : jak popovic
Date : March 29 2020, 07:55 AM
I wish did fix the issue. Remove "Microsoft.AspNetCore.Mvc.Core": "1.0.1" and "Microsoft.AspNet.Mvc": "6.0.0-rc1-final", then replace it with "Microsoft.AspNetCore.Mvc": "1.0.1"
Final version
code :
{
  "dependencies": {
    "Microsoft.AspNetCore.Diagnostics": "1.0.0",
    "Microsoft.AspNetCore.Mvc": "1.0.1",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
    "Microsoft.AspNetCore.StaticFiles": "1.0.0",
    "Microsoft.Extensions.Logging.Console": "1.0.0",
    "Microsoft.NETCore.App": {
      "version": "1.0.1",
      "type": "platform"
    }
  }
Asp.net Core EF options.UseInMemoryDatabase System.TypeLoadException

Asp.net Core EF options.UseInMemoryDatabase System.TypeLoadException


By : Albert
Date : March 29 2020, 07:55 AM
this will help After trying, I changed "1.0.0-rc2-final" to "1.1.0" which I already have tried, but I found there is an warning, "Dependency conflict. CoreMVCWebAPI 1.0.0 expected Microsoft.EntityFrameworkCore.InMemory >= 1.1.0 but received 1.0.0-rc2-final", after install this package manually instead of only changing project.json, it works now.
code :
Install-Package Microsoft.EntityFrameworkCore.InMemory
ASP.NET Core TypeLoadException Could not load type 'System.Web.PreApplicationStartMethodAttribute' from assembly 'System

ASP.NET Core TypeLoadException Could not load type 'System.Web.PreApplicationStartMethodAttribute' from assembly 'System


By : elly
Date : March 29 2020, 07:55 AM
around this issue After a couple hours of debugging, the solution turned out to be an incorrect using statement.
SelectListItem exists in both System.Web and Microsoft.AspNetCore.Mvc.Rendering
code :
using Microsoft.AspNetCore.Mvc.Rendering;
System.TypeLoadException Microsoft.VisualBasic ASP.NET Core 2

System.TypeLoadException Microsoft.VisualBasic ASP.NET Core 2


By : Vishsth Chaturvedi
Date : March 29 2020, 07:55 AM
I wish did fix the issue. [This isn't exactly an answer but it is a solution that works in place of the above assembly.]
I built this class to replace the functionality provided by the FileIO.TextFieldParser in Microsoft.VisualBasic and to be API compliant with it. The below only provides the functionality I needed so expand as desired.
code :
public class TextFieldParser : StreamReader, IDisposable
{
    int iToken = 1;
    bool quoted = false;
    char[] delimiters;
    string curLine;

    public TextFieldParser(string path) : base(path) { }

    public TextFieldParser(Stream stream) : base(stream) { }

    public string[] ReadFields()
    {
        curLine = ReadLine();

        return GetFields();
    }

    public void SetDelimiters(string delim)
    {
        delimiters = delim.ToCharArray();
    }

    public string[] GetFields()
    {
        if (delimiters == null || delimiters.Length == 0)
            throw new Exception($"{GetType().Name} requires delimiters be defined to identify fields.");

        if (!hasFieldsEnclosedInQuotes)
        {
            return curLine.Split(delimiters);
        }
        else
        {
            var token = (char)iToken;
            var sb = new StringBuilder();

            // Go through the string and change delimiters to token
            // ignoring them if within quotes if indicated
            for (int c = 0; c < curLine.Length; c++)
            {
                var qc = curLine[c];

                if (hasFieldsEnclosedInQuotes && qc == '"')
                {
                    quoted = !quoted;
                    continue;
                }
                else if (!quoted)
                {
                    // Replace the delimiters with token
                    for (int d = 0; d < delimiters.Length; d++)
                    {
                        if (qc == delimiters[d])
                        {
                            qc = token;
                            break;
                        }
                    }
                }

                sb.Append(qc);
            }

            return sb.ToString().Split(token);
        }
    }

    private bool hasFieldsEnclosedInQuotes = false;
    public bool HasFieldsEnclosedInQuotes
    {
        get { return hasFieldsEnclosedInQuotes; }
        set { hasFieldsEnclosedInQuotes = value; }
    }

    public bool EndOfData
    {
        get { return EndOfStream; }
    }
shadow
Privacy Policy - Terms - Contact Us © soohba.com