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

ExecuteMySqlBulkCopyAsync在.net core 3.1上 System.MissingMethodException : Method not found: 'System.Threading.Tasks.Task MySqlConnector.MySqlBulkCopy.WriteToServerAsync #783

Closed
luoyunchong opened this issue Jun 1, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@luoyunchong
Copy link
Collaborator

luoyunchong commented Jun 1, 2021

问题描述及重现步骤:

.net core 3.1 上使用 ExecuteMySqlBulkCopyAsync 会报如下错误。
.net 5.0 上运行正常。

 FreeSql.Tests.Provider.MySqlConnector.FreeSqlMySqlConnectorGlobalExtensionsTest.ExecuteMySqlBulkCopyAsync
   持续时间: 1.2 秒

  消息: 
    System.MissingMethodException : Method not found: 'System.Threading.Tasks.Task MySqlConnector.MySqlBulkCopy.WriteToServerAsync(System.Data.DataTable, System.Threading.CancellationToken)'.
  堆栈跟踪: 
    <<ExecuteMySqlBulkCopyAsync>b__0>d.MoveNext()
    AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
    <>c__DisplayClass1_0`1.<ExecuteMySqlBulkCopyAsync>b__0(MySqlBulkCopy bulkCopy)
    FreeSqlMySqlConnectorGlobalExtensions.ExecuteMySqlBulkCopyAsync[T](IInsert`1 that, Nullable`1 bulkCopyTimeout, CancellationToken cancellationToken) 行 114
    FreeSqlMySqlConnectorGlobalExtensionsTest.ExecuteMySqlBulkCopyAsync() 行 28
    --- End of stack trace from previous location where exception was thrown ---

 public class FreeSqlMySqlConnectorGlobalExtensionsTest
    {
        class BulkCopyValue
        {
            public Guid id { get; set; }
            public DateTime createtime { get; set; }
        }
        [Fact]
        public async Task ExecuteMySqlBulkCopyAsync()
        {
            var fsql = g.mysql;
            fsql.CodeFirst.SyncStructure<BulkCopyValue>();

            List<BulkCopyValue> bulkCopyValues = new List<BulkCopyValue>();
            for (var i = 0; i < 1000; i++)
            {
                bulkCopyValues.Add(new BulkCopyValue() { createtime = DateTime.Now });
            }
            await fsql.Insert<BulkCopyValue>().AppendData(bulkCopyValues).ExecuteMySqlBulkCopyAsync();
        }
    }

数据库的具体版本

mysql 5.7.34

安装的包

FreeSql.Provider.MySqlConnector 2.5.100

.net framework/. net core? 及具体版本

. net core3.1
@luoyunchong
Copy link
Collaborator Author

支持

net45;net461;net471;netstandard1.3;netstandard2.0;netstandard2.1;netcoreapp2.1;netcoreapp3.1;net5.0

我这边测试,加上 netstandard2.1;netcoreapp2.1;netcoreapp3.1; 即可

@axinno1
Copy link

axinno1 commented Jun 10, 2021

问题得到解决,谢谢叶老板

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants