如何解决argumentnullexception [英] how to solve argumentnullexception

查看:93
本文介绍了如何解决argumentnullexception的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

byteBuff = Convert.FromBase64String(Rptpwd);





在调试时给出了argumentnullex



值不能为空。

参数名称:InString



如何解决这个问题????

解决方案

显然 Rptpwd 不应该是 null 和您应该先设置一个值,但要避免例外,您可以这样做:

 如果 (Rptpwd!=  null 
byteBuff = Convert.FromBase64String(Rptpwd);


使用调试器,并检查 Rptpwd 的值 - 它可能不包含任何字符串或无效的Base64字符串。但是,我担心,由你决定原因 - 我们无法看到你的屏幕,访问你的硬盘或读你的想法! :笑:

byteBuff = Convert.FromBase64String(Rptpwd);


while debugging this is giving argumentnullexception

Value cannot be null.
Parameter name: InString

how do i solve this????

解决方案

Obviously Rptpwd should not be null and you should have set it with a value earlier, but to avoid the exception you can do :

if(Rptpwd!=null)
    byteBuff = Convert.FromBase64String(Rptpwd);


Use the debugger, and check the value of Rptpwd - the chances are it doesn't contain any string, or an invalid Base64 string. THen, I'm afraid, it's up to you to work out why - we can't see your screen, access your HDD, or read your mind! :laugh:


这篇关于如何解决argumentnullexception的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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