Link to home
Start Free TrialLog in
Avatar of brgdotnet
brgdotnetFlag for United States of America

asked on

Creating a null reference exception

I would like to force a null reference exception at line 3. An exception is not occurring? I am trying to test some ideas for more secure code, as null reference frequently occurs during our scans. So how would I force a null reference exception at line 3 for strTest which is passed in by reference?


1  Private Sub GetStuff(ByRef strTest As String)
2  strTest = Nothing
3 Dim k As String = strTest
4 End Sub
ASKER CERTIFIED SOLUTION
Avatar of Shaun Vermaak
Shaun Vermaak
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial