CLMSUK / S22.Imap

A free, easy-to-use and well-documented .NET library component for communicating with IMAP servers
http://smiley22.github.com/S22.Imap/Documentation/
3 stars 0 forks source link

Test MessageWithEncodedAttachmentName is failed #1

Open theofilis opened 5 years ago

theofilis commented 5 years ago

Describe the bug Failed with the following error.

Test Name:  MessageWithEncodedAttachmentName
Test FullName:  S22.Imap.Tests.MessageBuilderTest.MessageWithEncodedAttachmentName
Test Source:    D:\Work\CLMS\S22.Imap\tests\S22.Imap.Tests\S22\Imap\Tests\MessageBuilderTest.cs : line 156
Test Outcome:   Failed
Test Duration:  0:00:00.009932

Result StackTrace:  
at System.Text.Encoding.GetDataItem()
   at System.Text.Encoding.get_HeaderName()
   at System.Net.Mime.EncodedStreamFactory.CreateHeader(Encoding encoding, Boolean useBase64Encoding)
   at System.Net.Mime.EncodedStreamFactory.GetEncoderForHeader(Encoding encoding, Boolean useBase64Encoding, Int32 headerTextLength)
   at System.Net.Mime.MimeBasePart.DecodeHeaderValue(String value)
   at System.Net.Mail.Attachment.set_Name(String value)
   at System.Net.Mail.Attachment..ctor(Stream contentStream, String name)
   at S22.Imap.MessageBuilder.CreateAttachment(Bodypart part, Byte[] bytes) in D:\Work\CLMS\S22.Imap\src\S22.Imap\MessageBuilder.cs:line 396
   at S22.Imap.MessageBuilder.AddBodypart(MailMessage message, Bodypart part, String content) in D:\Work\CLMS\S22.Imap\src\S22.Imap\MessageBuilder.cs:line 372
   at S22.Imap.MessageBuilder.FromMIME822(String text) in D:\Work\CLMS\S22.Imap\src\S22.Imap\MessageBuilder.cs:line 73
   at S22.Imap.Tests.MessageBuilderTest.MessageWithEncodedAttachmentName() in D:\Work\CLMS\S22.Imap\tests\S22.Imap.Tests\S22\Imap\Tests\MessageBuilderTest.cs:line 157
Result Message: 
Test method S22.Imap.Tests.MessageBuilderTest.MessageWithEncodedAttachmentName threw exception: 
System.NotSupportedException: No data is available for encoding 20866. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.

To Reproduce Steps to reproduce the behavior:

  1. Run test MessageBuilderTest.BuildMessageFromHeader

Expected behavior Not to throw an error.

Desktop (please complete the following information):

theofilis commented 5 years ago

And BuildMessageFromHeader is failed

Test Name:  BuildMessageFromHeader
Test FullName:  S22.Imap.Tests.MessageBuilderTest.BuildMessageFromHeader
Test Source:    D:\Work\CLMS\S22.Imap\tests\S22.Imap.Tests\S22\Imap\Tests\MessageBuilderTest.cs : line 18
Test Outcome:   Failed
Test Duration:  0:00:00.0816438

Result StackTrace:  
at System.Text.Encoding.GetDataItem()
   at System.Text.Encoding.get_BodyName()
   at S22.Imap.Tests.MessageBuilderTest.BuildMessageFromHeader() in D:\Work\CLMS\S22.Imap\tests\S22.Imap.Tests\S22\Imap\Tests\MessageBuilderTest.cs:line 20
Result Message: 
Test method S22.Imap.Tests.MessageBuilderTest.BuildMessageFromHeader threw exception: 
System.NotSupportedException: No data is available for encoding 50220. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.
jstedfast commented 5 years ago

Have you considered saving yourself a ton of time and just using MailKit? :)

It's a LOT more robust and it is already ported to .NET Core.

theofilis commented 5 years ago

Thank you, I will check it!

jstedfast commented 5 years ago

You're welcome :-)

The next release will be adding NOTIFY, OBJECTID, STATUS=SIZE, and SOCKS4/SOCKS5 support as well (the README.MD has already been updated with those features, but there's no current release with them).