c# - klocwork Error: No permission set for resource 'streamWriter' before accessing it -
with article,
https://support.roguewave.com/documentation/klocwork/en/10-x/cs.nps/
i still getting klocwork error, after explicitly setting security. solution resolve it.
it's giving error below line of code,
streamwriter.writeline("hello");
here full code,
using (var stream = new filestream(@"c:\\sample.txt", filemode.create)) { var security = new system.security.accesscontrol.filesecurity(); security.addaccessrule(new filesystemaccessrule(@"domain\user", filesystemrights.modify, accesscontroltype.allow)); stream.setaccesscontrol(security); using (var streamwriter = new streamwriter(stream)) { streamwriter.writeline("hello"); } }
Comments
Post a Comment