[NpgSql] LargeObject.Read() -> "The Connection is broken."

Hallo,

ich versuche gerade mit C#/NpgSql und folgendem Code große Objekte (~100MB) auszulesen (schreiben funktioniert problemlos):

NpgsqlTransaction t = con.BeginTransaction();
LargeObjectManager lom = new LargeObjectManager(con);
LargeObject lo = lom.Open(oid);
 
int size = lo.Size();
byte[] pic = new byte[size];
pic = lo.Read(size);
 
lo.Close();
 
t.Commit();

Nach kurzer Zeit in der lo.Read()-Methode bekomme ich folgende Exception:

Npgsql.NpgsqlException was unhandled
Message="The Connection is broken."
Source="Npgsql"
BaseMessage="The Connection is broken."
StackTrace:
at NpgsqlTypes.Fastpath.FastpathCall(Int32 fnid, Boolean resulttype, FastpathArg[] args)
at NpgsqlTypes.Fastpath.GetData(String name, FastpathArg[] args)
at NpgsqlTypes.LargeObject.Read(Int32 len)
at DBAccess.Form1.ReadFromDB() in ...

Was mache ich da falsch?

mfg
cfi

Problem gelöst:

[size=84][color=#0000ff]int[/color][/size][size=84] off = 0;[/size]
[size=84][color=#0000ff]while[/color][/size][size=84] (off < size)[/size]
[size=84]{[/size]
[size=84][color=#0000ff]int[/color][/size][size=84] read = lo.Read(pic, off, 204800);[/size]
[size=84]off += read;[/size]
[size=84]}[/size]