Issue in conversion from .VM to .XML using nVelocity ---Urgent


We use a mainfile,.vm in our project for that nvelocity is used to convert it into XML file.
But some times it lead to an strange situation instead of creating XML file of more than 1 kb it create MainFile.xml of size 1 kb and if i tried accessing the file it shows the attached exception. Hence breaking of code
Though we had an alternative to resolve this issue by doing IIS reset but its a temporary solution . I would appreciate if u guys provide me the permanent solution for it.
Since IIS reset resolve the issue we doubted that may be the nVelocity DLL loaded into the memory and once IIS reset is done it get release from the memory.
Also, This issue is mainly occur on Development and Staging server but rarely occur on production.
Please provide the solution for it ASAP. would appreciate if get quick response from your end.

file attachments