"值不能为空.参数名称:reportedElement"将新的 Always Encrypted 列添加到现有表时 [英] "Value cannot be null. Parameter name: reportedElement" when adding a new Always Encrypted column to an existing table

查看:35
本文介绍了"值不能为空.参数名称:reportedElement"将新的 Always Encrypted 列添加到现有表时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 Visual Studio 数据库项目 (SSDT),我向现有表添加了一个新列.我正在使用 Always Encrypted 来加密各个列.当我添加列并尝试发布时,我在 Visual Studio 中看到一个弹出窗口,显示值不能为空.参数名称:reportedElement".

如果我不加密该列,它就可以工作.如果我从表中清除现有数据,它就可以工作.但是只是尝试添加一个新的可为空的加密列并不会发布.它甚至不会生成要应用的脚本.

我运行了 daxFX 和 SSDT 日志记录并使用 Windows 事件查看器查看了日志,但我只看到相同的错误值不能为空.参数名称:reportedElement".

这是添加的列定义的样子.

[MyNewColumn] INT ENCRYPTED WITH (COLUMN_ENCRYPTION_KEY = [DefaultColumnEncryptionKey], ENCRYPTION_TYPE = DETERMINISTIC, ALGORITHM = 'AEAD_AES_256_CBC_HMAC_SHA_256') NULL

我希望 Visual Studio 能够成功发布,添加我的新的可为空的加密列,但实际行为是一个弹出窗口,指出值不能为空.参数名称:reportedElement".

解决方案

我遇到了完全相同的问题,只是我解密了该列以执行基于它的查找,而我在加密时无法执行该查找(这是一个本地开发数据库).

解决方案是通过 SSMS 手动执行加密,然后运行发布.我不确定为什么 VS 无法发布更改,加密密钥存储在本地证书存储中,VS 以管理员身份运行,但它可能无法访问密钥来加密数据,但 SSMS 可以.

Using Visual Studio database projects (SSDT) I added a new column to an existing table. I am using Always Encrypted to encrypt individual columns. When I add the column and try to publish, I get a popup in Visual Studio that says "Value cannot be null. Parameter name: reportedElement".

If I don't encrypt the column, it works. If I clear the existing data out of the table, it works. But just trying to add a new nullable encrypted column does not publish. It will not even generate the script that would be applied.

I ran the daxFX and SSDT logging and viewed the logs with Windows Event Viewer, but I just see the same error "Value cannot be null. Parameter name: reportedElement".

This is what the added column definition looks like.

[MyNewColumn] INT ENCRYPTED WITH (COLUMN_ENCRYPTION_KEY = [DefaultColumnEncryptionKey], ENCRYPTION_TYPE = DETERMINISTIC, ALGORITHM = 'AEAD_AES_256_CBC_HMAC_SHA_256') NULL

I expect Visual Studio to publish successfully, adding my new nullable encrypted column but the actual behavior is a pop up that states "Value cannot be null. Parameter name: reportedElement".

解决方案

I had the exact same issue, except I had decrypted the column to perform a lookup based on it that I couldn't while it was encrypted (this is a local development db).

The solution was to just perform the encryption manually via SSMS and then run the publish. I'm not sure why VS can't publish the changes, the encryption keys are stored in the local cert store and VS is running as admin but it might not be able to access the keys to encrypt the data but SSMS can.

这篇关于"值不能为空.参数名称:reportedElement"将新的 Always Encrypted 列添加到现有表时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆