Je suis en train de charger une image et en utilisant WebClient avec DownloadData pour obtenir le tableau d'octets, mais maintenant il me lance une exception:WebClient.DownloadData lance une exception dans le Cadre de Bot
Exception: State size exceeded configured limit.
[File of type 'text/plain']
Je n'ai pas remarqué un tel comportement avant avec exactement la même image. Qu'est-ce qui aurait pu mal tourner?
private async Task SendPhoto_ActivityReceivedAsync(IDialogContext context, IAwaitable<object> result)
{
Activity activity = await result as Activity;
Activity activityReply = activity.CreateReply();
if (0 < activity.Attachments?.Count)
{
if (activity.Attachments.FirstOrDefault().ContentType.Equals("image/jpg") ||
activity.Attachments.FirstOrDefault().ContentType.Equals("image/jpeg") ||
activity.Attachments.FirstOrDefault().ContentType.Equals("image/png") ||
activity.Attachments.FirstOrDefault().ContentType.Equals("image/tiff"))
{
picImage = activity.Attachments.FirstOrDefault().Name;
HttpClient httpClient= new HttpClient();
picImageFile = await httpClient.GetByteArrayAsync(activity.Attachments.FirstOrDefault().ContentUrl);
await context.PostAsync("Want to send another?");
context.Wait(SendAnotherImage_ActivityReceivedAsync);
}
}
}
MISE À JOUR: Changé le WebClient HttpClient.GetByteArrayAsync et le problème reste. L'exception est affichée dans l'émulateur de robot juste après l'exécution de PostAsync
Jetez un oeil à https://stackoverflow.com/questions/46527098/botframework-state-size-exceeded-configured-limit – GrandMasterFlush
Vous devez attacher toute trace de la pile. Je doute que DownloadData lève cette exception. Cela devrait être du code Bot, comme PostAsync. – Evk
btw vous pouvez remplacer '0
aloisdg