HTTPS Constructor Exception

0 votes
asked Dec 3 by lcrmj (130 points)
edited Dec 3 by lcrmj

Hi.

One of our customer reported a crash in our application, this is the exception message:

The type initializer for 'hezq' threw an exception. - at hezq.vinp(String brp).

The exception is thrown at this snippet

_creator = new HttpRequestCreator();

I tried to identify the cause but got no luck. Does anyone have any ideas? This is the full trace:

Full Trace

2 Answers

+1 vote
answered Dec 3 by Lukas Matyska (47,950 points)

Does the exception has InnerException specified? It can contain further details.

However, it seems that the you are using wrong assemblies (please check target framework and version).

If you are running your app on Windows CE, please ensure that you have referenced assemblies from netcf-x.y installation directory (e.g. c:\Program Files (x86)\Rebex Components 2018 R3\bin\netcf-3.5).

If you are using your app on desktop Windows, please ensure that you have referenced assemblies form net-x.y installation directory (e.g. c:\Program Files (x86)\Rebex Components 2018 R3\bin\net-4.0).

More precisely, please ensure that your application was deployed with correct version of assemblies.
Go to deploy location, right click on .dll, select Properties, select Details tab, check File description (check version and framework). Check this for all .dll files.

commented Dec 3 by lcrmj (130 points)
Not sure about the inner exception, we got the error from a customer and we can't reproduce it here... to get that info I'll need to build a special version logging it, it's not really a problem to do so if you really think that's necessary but I'd rather not bother our customer if that's possible :p

All dlls are "xxx (2018 R2) for .NET 4.0-4.7" and it's a desktop application.

Could the error be caused by somekind of Windows configuration, firewall or proxy?
commented Dec 4 by Lukas Matyska (47,950 points)
The exception was thrown during initialization of crypto services. It seems that OS on device  of your customer doesn't support some crypto features and we failed to ignore it correctly. It is not related to firewall or proxy.

The inner exception will help us to locate the source of the issue. Please, log the exception like this:

    try
    {
        _creator = new HttpRequestCreator();
    }
    catch (TypeInitializationException ex)
    {
        Log.Write(ex.ToString());
    }

1. I suppose that the exception is thrown always?
2. If you have to create new build, can you please use the latest version 2018 R3 to ensure the issue was not already solved?
commented Dec 4 by lcrmj (130 points)
According to their description of the issue, yes, it always happens
Our support team is in touch with one of the customers so we can find the best time to install the special version on his machine, it should happen in the start of next week. I'll get back when we do it.

Thanks for the support so far.
commented Dec 7 by lcrmj (130 points)
Managed to get the inner exception
https://pastebin.com/JiuFgVN9
commented Dec 7 by renestein (2,310 points)
edited Dec 7 by renestein
Hi lcrmj,
thanks for the information.

Just as I suspected, thrown exception is indeed "System.Security.VerificationException: Operation could destabilize the runtime".

Exception message “System.Security.VerificationException: Operation could destabilize the runtime” sounds very creepy. The truth is that we  don’t do any dangerous operation with possibly catastrophic consequences for the runtime.

This enigmatic exception probably has very prosaic reason described above.
Please make sure that you have applied the hotfix.

You can also diagnose the problem using the PEVerify tool.
https://docs.microsoft.com/en-us/dotnet/framework/tools/peverify-exe-peverify-tool

If nothing from the above works and you still experience the problem, I would like to kindly ask you to share minimalistic project, which demonstrates this problem, with us.
Please send us also:

1) .Net Framework version used to compile the application.
2) .Net Framework version used to run the application.
3) Full windows version (output of the command winver).
commented 6 days ago by lcrmj (130 points)
Hi renestein,

The link you provided got taken down so the support team installed this one instead https://www.microsoft.com/en-us/download/details.aspx?id=34966, they seem to be referring to the same issue, could you confirm that?
commented 5 days ago by renestein (2,310 points)
edited 5 days ago by renestein
Hi lcrmj,
your link is broken as well (404). Unfortunately, I could not find the hotfix on Microsoft web/Update catalog. I have found this page (https://www.microsoft.com/en-us/download/details.aspx?id=34966). You can see that the page refers to the KB2748645 on the bottom (section Additional info). I think this is a typo, because hotfix files and top of the page mentions KB2748646.
Please contact Microsoft directly/on MSDN forum.
I think that you don't have patch for SecurityVerificationException installed.
I am sure that few days ago all links worked.:(
commented 4 days ago by lcrmj (130 points)
I placed a question on MSDN... no answers so far... :/
Do you know if updating to .Net 4.6 could fix the issue?
commented 4 days ago by renestein (2,310 points)
. Net 4.6  is in-place upgrade of. Net, so AFAIK this issue should be fixed.
commented 4 days ago by lcrmj (130 points)
Thanks renestein,
All give it a try and come back with the outcome!
0 votes
answered Dec 4 by renestein (2,310 points)
edited Dec 5 by renestein
Hi  lcrmj,
thanks for the info!  I could only guess now that your problem may be related to the support request that was raised few weeks ago.

1) Inner exception is probably SecurityVerificationException.
2) Your client uses version of the .Net 4.5 with well-known bug.

Description of the problem and the hotfix can be found here.

https://support.microsoft.com/en-us/help/2748645/an-update-is-available-for-the-net-framework-4-5-in-windows-7-windows

More info about problem.
https://elegantcode.com/2012/08/23/net-4-5-operation-could-destabilize-the-runtime-yikes/
commented Dec 4 by lcrmj (130 points)
Hi renestein,

I can confirm one of our costumers with the issue is using .NET 4.5, don't know about others tho. We told this customer to install the update, he'll get it done by tomorrow. I'll comment again once we get his feedback.

Could you add your comment as an answer so I can mark it as best answer if that's really the issue?

Thank you for your help
commented Dec 7 by lcrmj (130 points)
Hi renestein,
Unfortunately it didn't work, the error keeps happening.

Thanks for the help tho!
commented Dec 7 by renestein (2,310 points)
Hi lcrmj,
 please see me comment above.
...