Vb.net 序列化类型为';的对象时检测到循环引用;系统.全球化.文化信息';

Vb.net 序列化类型为';的对象时检测到循环引用;系统.全球化.文化信息';,vb.net,httphandler,circular-reference,Vb.net,Httphandler,Circular Reference,我试图将表从SQLite db获取到一个数据集中,但出现了一个错误“序列化'System.Globalization.CultureInfo'类型的对象时检测到循环引用”。从联机阅读的内容来看,我需要使用该属性,但我不知道在何处 这是我正在使用的http处理程序: Imports System.Web.Script.Serialization Public Class HTTPHandler Implements System.Web.IHttpHandler Sub ProcessRequ

我试图将表从SQLite db获取到一个数据集中,但出现了一个错误“序列化'System.Globalization.CultureInfo'类型的对象时检测到循环引用”。从联机阅读的内容来看,我需要使用该属性,但我不知道在何处

这是我正在使用的http处理程序:

Imports System.Web.Script.Serialization

Public Class HTTPHandler
Implements System.Web.IHttpHandler

Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest

    Dim dataset = _Default.GetTables()

    Dim serializer As New JavaScriptSerializer

    Dim serDS = serializer.Serialize(dataset)

    context.Response.ContentType = "aplication/json"
    context.Response.ContentEncoding = Encoding.UTF8
    context.Response.Write(serDS)
End Sub

ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
    Get
        Return False
    End Get
End Property

End Class

对不起,我的英语不好。我还在学这门语言

那么,关于你的问题:

尝试:

Dim serDS=serializer.Serialize(dataset.GetXml())

理论上,数据集是序列化的。。。但是由于某种原因我不知道。。。如果不转换为xml,它就不起作用


还有一次,我为我糟糕的英语感到抱歉=p

是的,这很有效,但它只会给我一个很长的字符串,很难解析出来。是否有任何方法可以使用ScriptIgnore忽略循环引用?