gpt4 book ai didi

VsCode debuger stop Suddenly in one of ASP.NET Core action(VsCode调试器在ASP.NET核心操作之一中突然停止)

转载 作者:bug小助手 更新时间:2023-10-25 12:06:19 25 4
gpt4 key购买 nike



When I run a action in my ASP.NET Core app debugger, I get this error:

当我在ASP.NET Core应用程序调试器中运行操作时,我收到以下错误:



The program has exited with code -1073741819 (0xc0000005).



My Action is this but never run in app:

我的行动是这样的,但从不在应用程序中运行:


[HttpPost]
public async Task<IActionResult> Create(RoleCUViewModel model)
{
//Do Some thing
}

And My ViewModel is this:

我的ViewModel是这样的:


public class RoleCUViewModel
{
[Required]
public string? Name
{
get => Name;
set
{
if (value != "Admin")
{
Name = value;
}
else Name = null;
}
}

public string? Description { get; set; }
}

I delete Authorize attribute and test in Action but my problem not solved.

我删除了授权属性并在操作中测试,但我的问题没有解决。


enter image description here


My IDE is VS Code and my application framework is .NET 7.0.

我的IDE是VS Code,我的应用程序框架是.NET7.0。


How can I fix this error?

如何修复此错误?


更多回答

We can see your screen, nor can we read your mind - you need to SHOW US the relevant code!

我们看不到您的屏幕,也看不到您的心思--您需要向我们展示相关代码!

优秀答案推荐

According to the error message The program has exited with code -1073741819 (0xc0000005)., and I found it's code issue, the getter for Name is recursively calling itself without any exit condition, leading to a stack overflow.

根据错误消息,程序已退出,代码为-1073741819(0xc0000005)。我发现这是代码问题,名称的Getter在没有任何退出条件的情况下递归调用自己,导致堆栈溢出。


public class RoleCUViewModel
{
private string? _name;

[Required]
public string? Name
{
get => _name;
set
{
if (value != "Admin")
{
_name = value;
}
else _name = null;
}
}

public string? Description { get; set; }
}

更多回答

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com