c# - .NET Core 3.1 - 设计器加载失败 - EntityFramework Core
问题描述
我有一个 .Net Core 3.1 项目(winforms)。对于每个表单,我都有一个所有表单都依赖的 baseForm。
在我的基类上,我有这个属性
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public DataContext con { get; set; }
DataContext 使用 EF Core 3.19 的地方。如果我尝试打开 Baseform 的任何后代形式的设计器,我会收到以下错误:
at System.Signature.GetSignature(Void* pCorSig, Int32 cCorSig, RuntimeFieldHandleInternal fieldHandle, IRuntimeMethodInfo methodHandle, RuntimeType declaringType)
at System.Reflection.RuntimeMethodInfo.FetchNonReturnParameters()
at System.Reflection.RuntimeMethodInfo.GetParametersNoCopy()
at System.Reflection.RuntimePropertyInfo.GetIndexParametersNoCopy()
at System.Reflection.RuntimePropertyInfo.GetIndexParameters()
at System.ComponentModel.ReflectTypeDescriptionProvider.ReflectGetProperties(Type type)
at System.ComponentModel.ReflectTypeDescriptionProvider.ReflectedTypeData.GetProperties()
at System.ComponentModel.TypeDescriptor.TypeDescriptionNode.DefaultTypeDescriptor.System.ComponentModel.ICustomTypeDescriptor.GetProperties()
at System.ComponentModel.TypeDescriptor.GetPropertiesImpl(Object component, Attribute[] attributes, Boolean noCustomTypeDesc, Boolean noAttributes)
at System.ComponentModel.TypeDescriptor.GetProperties(Object component)
at Microsoft.DotNet.DesignTools.Serialization.CodeDomSerializerBase.GetPropertiesHelper(IDesignerSerializationManager manager, Object instance, Attribute[] attributes)
at Microsoft.DotNet.DesignTools.Serialization.CodeDomSerializerBase.DeserializePropertiesFromResources(IDesignerSerializationManager manager, Object value, Attribute[] filter)
at Microsoft.DotNet.DesignTools.Serialization.TypeCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, CodeTypeDeclaration declaration)
at Microsoft.DotNet.DesignTools.Sessions.Session.DeserializeToRootComponent(CodeTypeDeclaration typeDeclaration)
at Microsoft.DotNet.DesignTools.Sessions.Session.DeserializeRootComponent(CodeTypeDeclaration typeDeclaration, ResourceContentData[] resourceDocDataContent, String basePath)
at Microsoft.DotNet.DesignTools.Protocol.Endpoints.Sessions.InitializeRootComponentHandler.HandleRequest(InitializeRootComponentRequest request)
at Microsoft.DotNet.DesignTools.Protocol.Endpoints.RequestHandler`2.Microsoft.DotNet.DesignTools.Protocol.Endpoints.IRequestHandler.HandleRequest(Request request)
与消息
Method 'DisposeAsync' in type 'Microsoft.EntityFrameworkCore.DbContext' from assembly 'Microsoft.EntityFrameworkCore, Version=3.1.19.0, ... does not have an implementation.
尽管在我的 DataContext 中我已经实现了以下方法:
public async ValueTask DisposeAsync()
{
await DisposeAsyncCore();
Dispose(disposing: false);
#pragma warning disable CA1816 // Dispose methods should call SuppressFinalize
GC.SuppressFinalize(this);
#pragma warning restore CA1816 // Dispose methods should call SuppressFinalize
}
有谁知道什么可能导致我的问题?我的设计师应该完全跳过 DataContext 属性..
解决方案
推荐阅读
- r - 在R中的某个字符串模式之后删除前4个单词?
- javascript - 如何修复 React.Children.only 预计会在 react.js 中接收单个 React 元素子项?
- python - 为什么 spark 无法识别我的“数据框布尔表达式”?
- c# - InstallUtil 会自动为您注册 .dll 吗?
- javascript - 如何使用javascript比较数组对象中的元素
- javascript - 控制台日志在函数返回对象时打印承诺,但在不是对象时打印数据
- java - 有 Lombok 注释 @Slf4j 不起作用
- drake - 如何在 Python 中创建线性/仿射系统的多项式轨迹?即时变 A 和 B 矩阵
- python - 如何在 ffprobe 中省略 JSON 输出中的错误消息?
- vaadin - 如何在 LitElement 的 vaadin 网格中延迟加载项目