In the process of unit testing,I tried to read a SQL file which I marked as embedded resource. It works fine in local. But when the unit test runs in the DevOps pipeline, I am getting ArgumentNullexpetion for the stream reader which uses the output of 'GetManifestResourceStream' I tried write in console the list of 'GetManifestResourceNames' it lists all SQL files correctly.
var assembly=Assembly.GetExecutingAssembly();
var filename=MethodBase.GetCurrentMethod().Declaring type.Namesapce+folder name+filename;
var stream= assembly.GetManifestResourceStream(filename);//returns null in pipeline but works perfectly in local.
var reader=new StreamReader(stream)
reader.ReadToEnd()// exception thrown
The code is placed in MSTest project and called in the ClassInitialize method. How to fix this pipeline exception