Click here to Skip to main content
15,879,096 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
byteBuff = Convert.FromBase64String(Rptpwd);


while debugging this is giving argumentnullexception

Value cannot be null.
Parameter name: InString

how do i solve this????
Posted
Updated 16-Feb-22 2:20am

Obviously Rptpwd should not be null and you should have set it with a value earlier, but to avoid the exception you can do :
C#
if(Rptpwd!=null)
    byteBuff = Convert.FromBase64String(Rptpwd);
 
Share this answer
 
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:
 
Share this answer
 
byteBuff = Convert.FromBase64String(Rptpwd ?? string.Empty);
 
Share this answer
 
Comments
Richard Deeming 17-Feb-22 12:20pm    
The null-coalescing operator (??) was added in C# 8, which was released 5½ years after this already-solved question was asked.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900