Home All Groups Group Topic Archive Search About

The type initializer for "HeaderEncoding" threw an exception

Author
6 Jul 2006 9:57 AM
TopBanana
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

Author
7 Jul 2006 8:56 AM
Walter Wang [MSFT]
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 (waw***@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.
Author
7 Jul 2006 10:08 AM
TopBanana
On Fri, 07 Jul 2006 08:56:30 GMT, waw***@online.microsoft.com (Walter
Wang [MSFT]) wrote:

>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
Author
7 Jul 2006 8:56 PM
Walter Wang [MSFT]
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).
--
Regards,
Walter Wang (waw***@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.
Author
8 Jul 2006 11:32 AM
TopBanana
On Sat, 8 Jul 2006 04:56:25 +0800, "Walter Wang [MSFT]"
<waw***@online.microsoft.com> wrote:

>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
Author
10 Jul 2006 8:35 AM
Walter Wang [MSFT]
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 (waw***@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.
Author
20 Jul 2006 9:19 PM
TopBanana
On Mon, 10 Jul 2006 08:35:43 GMT, waw***@online.microsoft.com (Walter
Wang [MSFT]) wrote:

>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.

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
Author
21 Jul 2006 6:27 AM
Walter Wang [MSFT]
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 (waw***@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.
Author
25 Jul 2006 9:11 AM
TopBanana
On Fri, 21 Jul 2006 06:27:20 GMT, waw***@online.microsoft.com (Walter
Wang [MSFT]) wrote:

>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
Author
26 Jul 2006 9:00 AM
Walter Wang [MSFT]
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 (waw***@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.
Author
27 Jul 2006 10:36 PM
TopBanana
On Wed, 26 Jul 2006 09:00:21 GMT, waw***@online.microsoft.com (Walter
Wang [MSFT]) wrote:

>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.
Author
28 Jul 2006 12:54 AM
Walter Wang [MSFT]
Thank you for your understanding.

Have a nice day!

Regards,
Walter Wang (waw***@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.

AddThis Social Bookmark Button