Search code examples
c#exceptionsqlfilestream

SqlFileStream exception "An invalid parameter was passed to the function"


I'm getting this exception:

An invalid parameter was passed to the function

when trying to create new instance from SqlFileStream. code:

var fileStream = new SqlFileStream(strSqlPath, bytArrContext, FileAccess.Write)

I checked for all the parameters non of them are null. I've been using this same exact code for awhile with no problems, i have no idea what's happening right now.


Solution

  • It is because of transaction. Please do this inside of a transaction scope.