我们如何处理stackoverflow异常C#

我们如何处理stackoverflow异常C#,c#,umbraco,C#,Umbraco,我正在Umbraco CMS上编写C#,然后Microsoft Visual Studio检测到我应该在上处理stackoverflow错误 var umbracoHelper = new Umbraco.Web.UmbracoHelper(Umbraco.Web.UmbracoContext.Current); Image = umbracoHelper.Media(imageId).GetCropUrl("umbracoFile", "image"); 我如何处理这个问题? 你可以在这个链

我正在Umbraco CMS上编写C#,然后Microsoft Visual Studio检测到我应该在上处理stackoverflow错误

var umbracoHelper = new Umbraco.Web.UmbracoHelper(Umbraco.Web.UmbracoContext.Current);
Image = umbracoHelper.Media(imageId).GetCropUrl("umbracoFile", "image");
我如何处理这个问题? 你可以在这个链接上看到完整的代码。

翁布拉科7.2.8版


工具:Microsoft Visual Studio 2013

我没有必要的声誉,无法对您的原始问题发表评论,因此无法给出此“答案”-因此我提前道歉

在您的代码示例中,没有任何东西会在您所指示的行周围抛出
StackOverflowException
,因此您需要深入查看。您可能会在GetCropUrl()扩展方法上得到一个NullReferenceException,尽管您还没有测试以确保meda项返回一个有效的对象

因此,其他人不必下载它-这是您的代码片段(不包括usings/namespace):


但是需要更多的信息-您可以发布异常的实际堆栈跟踪吗?

什么是
图像
?它是财产吗?向我们显示声明。调试器可能并不总是告诉您问题的确切位置。因为很难发现这个问题。您使用递归调用吗?如果它是
StackOverflowException
,那么您无法捕获/处理它。。。这是一个特殊的恐慌例外;)如果您想处理
StackOverflow
exception;),您来对地方了但是我们需要更多的信息。如果你不能“处理”堆栈溢出,你必须修复错误。引发异常的位置很少是bug的确切位置。
public class Case
{
    public Case(IPublishedContent content) 
    {
        Id = content.Id;
        Description = content.GetPropertyValue<string>("description");
        Title = content.GetPropertyValue<string>("title");

        //image
        string image = content.GetPropertyValue<string>("image");            
        int imageId = 0;
        int.TryParse(image, out imageId);
        if (imageId != 0)
        {

                var umbracoHelper = new Umbraco.Web.UmbracoHelper(Umbraco.Web.UmbracoContext.Current);
                Image = umbracoHelper.Media(imageId).GetCropUrl("umbracoFile", "image");          
        }



        //Team
        string teamID = content.GetPropertyValue<string>("teamMember");
        Team = DAL.GetTeamProperties(teamID);
    }

    public Case() { }
    public int Id { get; set; } 
    public string Title { get; set; }            
    public string Description { get; set; }
    public string Image { get; set; }
    public List<Team> Team { get; set; }
}
Team = DAL.GetTeamProperties(teamID);