Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / July 2006

Tip: Looking for answers? Try searching our database.

The type initializer for "HeaderEncoding" threw an exception

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
TopBanana - 06 Jul 2006 10:57 GMT
Hi

I wonder if anyone has seen this before?

I have two machines running exactly the same code.  On the first, it
works perfectly, on the second I get the TypeInitializationException
'The type initializer for "HeaderEncoding" threw an exception'.

I am using an HttpWebRequest, and the exception occurs when I flush my
input to the RequestStream.

I have tried reinstalling the dotnet fx, but to no avail.

Thanks
Walter Wang [MSFT] - 07 Jul 2006 09:56 GMT
Hi,

Thank you for your post.

Would you please telling me the call stack when the  exception is thrown?

Also, since this problem is environment specific, you can use some http
trace tool such as Fiddler to check the http request details on different
machines. You can find Fiddler here: http://www.fiddlertool.com/fiddler/

I'm looking forward to your findings so that we can continue the
troubleshooting. Thanks.

Regards,
Walter Wang (wawang@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
TopBanana - 07 Jul 2006 11:08 GMT
>Would you please telling me the call stack when the  exception is thrown?
>
>Also, since this problem is environment specific, you can use some http
>trace tool such as Fiddler to check the http request details on different
>machines. You can find Fiddler here: http://www.fiddlertool.com/fiddler/

Hi Walter.  Thanks for your reply.

Interesting, Fiddler threw the exact same exception on startup, and
here is a copy of the dialog:

---------------------------
Sorry, you've found a bug.
---------------------------
Fiddler has encountered an unexpected problem.  If you believe this is
a bug in Fiddler, please copy this message by hitting CTRL+C, and
submit a bug report using the Help | Send Feedback menu.
Unable to create a transport connection.
  at System.Net.Connection.StartConnectionCallback(Object state,
Boolean wasSignalled)
System.TypeInitializationException: The type initializer for
"HeaderEncoding" threw an exception. ---> System.ArgumentException:
Invalid or unsupported code page type.
  at System.Text.CodePageEncoding.GetCPMaxCharSizeNative(Int32
codePage)
  at System.Text.CodePageEncoding..ctor(Int32 codepage)
  at System.Text.Encoding.GetEncodingRare(Int32 codepage)
  at System.Text.Encoding.GetEncoding(Int32 codepage)
  at System.Net.HeaderEncoding..cctor()
  --- End of inner exception stack trace ---
  at System.Net.HttpWebRequest.MakeRequest()
  at System.Net.HttpWebRequest.EndSubmitRequest()
  at System.Net.HttpWebRequest.SetRequestSubmitDone(ConnectStream
submitStream)
  at System.Net.Connection.StartConnectionCallback(Object state,
Boolean wasSignalled) Fiddler v1.2.0.0
---------------------------
OK  
---------------------------

Thanks,
- James
Walter Wang [MSFT] - 07 Jul 2006 21:56 GMT
Hi James,

Thank you for your quick reply.

From the call stack of the exception, the exception is raised while getting
an Encoding. It's rather strange that it will fail.

Could you please check the version of installed .NET Framework? You can use
method described here:

#How to determine which versions of the .NET Framework
http://support.microsoft.com/default.aspx?kbid=318785

Please follow the steps described in the KB to check your two machines'
installed .NET Framework version and see if they're different. From
Fiddler's requirements, it requires v1.1 (4322).
Signature

Regards,
Walter Wang (wawang@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

TopBanana - 08 Jul 2006 12:32 GMT
>From the call stack of the exception, the exception is raised while getting
>an Encoding. It's rather strange that it will fail.
>
>Could you please check the version of installed .NET Framework?

Hi Walter,

Yes it does seem strange that it should fail.  I've googled the
problem and it seems some other people have seen it too.

The mscorlib version is 1.1.4322.2032 (1.1 sp1)

Thanks
- James
Walter Wang [MSFT] - 10 Jul 2006 09:35 GMT
Hi James,

Thank you for your update.

From a similar case, I found one possible cause of this issue:

Missing registry key
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage]
"28591"="c_28591.nls"

I've tested on my machine by removing the registry value and run Fiddler,
it does show the exception as you described. So it's very likely the cause
of your issue too, please let me know if this works or not. Thanks.

Hope this helps. Please feel free to post here if anything is unclear.

Regards,
Walter Wang (wawang@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
TopBanana - 20 Jul 2006 22:19 GMT
>From a similar case, I found one possible cause of this issue:
>
[quoted text clipped - 5 lines]
>it does show the exception as you described. So it's very likely the cause
>of your issue too, please let me know if this works or not. Thanks.

Hi Walter,

Unfortuantely it looks like that key is present in the registry.

Any other ideas?  Could it be looking for a differnt codepage for some
reason?

Thanks
Walter Wang [MSFT] - 21 Jul 2006 07:27 GMT
Hi,

Thank you for your update.

Since you've mentioned one of your two machines is running the application
correctly, I recommend you export the registry key and compare these two
exported files to see if there're any difference.

I'm looking forward to your findings.

Regards,
Walter Wang (wawang@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
TopBanana - 25 Jul 2006 10:11 GMT
>Since you've mentioned one of your two machines is running the application
>correctly, I recommend you export the registry key and compare these two
>exported files to see if there're any difference.

Hi Walter,

The entire codepage key on both machines is identical.

- James
Walter Wang [MSFT] - 26 Jul 2006 10:00 GMT
Hi James,

Thank you for your update.

From the internal log of the possible cause, such cause will need live
debugging or dump analysis to find out. Unfortunately that's out of
newsgroup support scope. Issues of this nature are best handled working
with a dedicated Microsoft Support Engineer by contacting Microsoft
Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.

Regards,
Walter Wang (wawang@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
TopBanana - 27 Jul 2006 23:36 GMT
>From the internal log of the possible cause, such cause will need live
>debugging or dump analysis to find out. Unfortunately that's out of
>newsgroup support scope.

OK Walter I will set something up with the support group.

Thanks for your assistance so far, you've been very helpful.
Walter Wang [MSFT] - 28 Jul 2006 01:54 GMT
Thank you for your understanding.

Have a nice day!

Regards,
Walter Wang (wawang@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.