Catch/Log sessionStore.Write exceptions (fix #248)

This commit is contained in:
Wizou 2024-04-28 00:44:36 +02:00
parent 3a7c5a0957
commit 4422aad6be
2 changed files with 11 additions and 4 deletions

View file

@ -149,9 +149,16 @@ namespace WTelegram
if (!_encryptor.CanReuseTransform) // under Mono, AES encryptor is not reusable
using (var aes = Aes.Create())
_encryptor = aes.CreateEncryptor(_reuseKey, _encrypted[0..16]);
_store.Position = 0;
_store.Write(_encrypted, 0, encryptedLen);
_store.SetLength(encryptedLen);
try
{
_store.Position = 0;
_store.Write(_encrypted, 0, encryptedLen);
_store.SetLength(encryptedLen);
}
catch (Exception ex)
{
Helpers.Log(4, $"{_store} raised {ex}");
}
}
_jsonStream.Position = 0;
_jsonWriter.Reset();

View file

@ -24,7 +24,7 @@
<PackageTags>Telegram;MTProto;Client;Api;UserBot</PackageTags>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageReleaseNotes>$(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A"))</PackageReleaseNotes>
<NoWarn>0419;1573;1591;NETSDK1138</NoWarn>
<NoWarn>NETSDK1138;CS0419;CS1573;CS1591</NoWarn>
<DefineConstants>TRACE;OBFUSCATION;MTPG</DefineConstants>
<!--<IsAotCompatible Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net7.0'))">true</IsAotCompatible>-->
</PropertyGroup>