Message 1 of 4
RealDWG 2013 - InvalidProgramException
Not applicable
05-25-2012
06:48 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
My company recently purchased RealDWG 2013 so we can import/export DWG/DXF files, obviously
I've hit a small stumbling block when integrating RealDWG 2013 into our application, we keep getting an InvalidProgramException.
Below is the code I have so far, not much but it throws the exception everytime on the line importTransaction = realDwgDatabase.TransactionManager.StartTransaction();
The dumpdwg sample that is installed with RealDWG 2013 is encountering this problem. Also the issue is the same using both 32/64-Bit versions of RealDWG 2013.
Is there some initialisation I'm missing or a licensing issue at play here? Any help would be much appreciated.
using (RealDWGImportHost host = new RealDWGImportHost())
{
RuntimeSystem.Initialize(host, 1337);
using (Database realDwgDatabase = new Database(false, true))
{
Transaction importTransaction = null;
try
{
realDwgDatabase.ReadDwgFile(mFileName, FileShare.None, false, null);
HostApplicationServices.WorkingDatabase = realDwgDatabase;
importTransaction = realDwgDatabase.TransactionManager.StartTransaction();
}
catch (System.Exception ex)
{
Console.Write(ex.Message);
}
finally
{
if (importTransaction != null)
{
importTransaction.Dispose();
}
}
}
}