Getting System.AccessViolationException when deleting MultiTerm ImportDefinition

Hi,

I'm using the following code to create a termbase and import terms. I'm getting a System.AccessViolationException when modified.Delete(); is reached.

This happens with the 2015 API, but not the 2014 API. Does anyone have similar experiences?

Sdl.MultiTerm.TMO.Interop.Application oMt = new Sdl.MultiTerm.TMO.Interop.Application();
TermbaseRepository oLocalRep = oMt.LocalRepository;
oLocalRep.Connect("", "");

Termbases oTbs = oLocalRep.Termbases;
oTbs.New(name, "", definition, path);
Sdl.MultiTerm.TMO.Interop.Termbase oTb = oTbs[path];

string tmpPath = System.Environment.GetEnvironmentVariable("TEMP") + "\\tmpImportDefinition.xml";
var importdefs = oTb.ImportDefinitions;
var defaultImportDef = importdefs["Default import definition"];
defaultImportDef.Save(tmpPath);
XmlDocument doc = new XmlDocument();
doc.Load(tmpPath);
XmlNode node = doc.SelectSingleNode("//XMLFile");
node.InnerXml = xmlPath.Replace("&", "&");
node = doc.SelectSingleNode("//ErrorFile");
node.InnerXml = logPath.Replace("&", "&");
doc.Save(tmpPath);

ImportDefinition modified = importdefs.Add("tmpImport", "", tmpPath);
modified.ProcessImport(MtTaskType.mtScript);

// clean up
modified.Delete();
System.IO.File.Delete(tmpPath);

Thanks in advance,

Adam