本文介绍了奇怪的“InvalidCast” Metro AES加密中的例外情况的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如上图所示:

变量" key"是CryptographicKey类型;

变量" clearTextBuffer"是IBuffer类型;

变量"iv"是IBuffer类型;

variable "key" is of type CryptographicKey;
variable "clearTextBuffer" is of type IBuffer;
variable "iv" is of type IBuffer;

方法CryptographicEngine.Encrypt(CryptographicKey,IBuffer,IBuffer)采用正确类型的参数;

Method CryptographicEngine.Encrypt(CryptographicKey, IBuffer, IBuffer) takes the right types of arguments;

但是当代码运行时在这一行中,"InvalidCastException"即使根本没有投射也被抛出。

But when the code runs to this line, an "InvalidCastException" was thrown even if there's no casting at all.

我无法弄清楚为什么这个问题,我错过了什么?

I can't figure out why about this issue, what is it I have missed?

非常感谢帮助。

推荐答案



------------------------------------------------ --------------------------------


--------------------------------------------------------------------------------

Alejandro Campos Magencio - Microsoft Escalation Engineer - 论坛版主

 如果我的回复回答了您的问题,请将此帖标记为已回答。

Alejandro Campos Magencio - Microsoft Escalation Engineer - Forum Moderator
 If my reply answers your question, please mark this post as answered.


这篇关于奇怪的“InvalidCast” Metro AES加密中的例外情况的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-21 10:39