home recent topics recent posts search faq  

RC-WinTrans Forum



register | lost password | |
Messages in this topic - RSS

Home » RC-WinTrans Support » RC-WinTrans 9.3 Wintrans.Exit() not working

For support issues and specific questions related to RC-WinTrans' use, features and functions.
19.12.2013 13:31:52

Kamesh
Kamesh
Posts: 7
We were using RC Wintrans X8 Global in our project involving multiple .rwt projects. But after upgrading to RC-Wintrans 9 the Exit( ) function is not working and we are getting the following error after completion of the 1st .rwt project.
WinTrans - Object reference not set to an instance of an object.
The project file is closed as seen in the Wintrans Editor. But the Wintrans application is not exiting
0 permalink
19.12.2013 21:58:13

Support
Support
Administrator
Posts: 245
Hello Kamensh!

> Object reference not set to an instance of an object.
>
Is it (1) your application which gets this message returned?
Or (2) is it an output in the RC-WinTrans Output window?

If (2) then it comes from the RC-WinTrans VBA system (a VBA macro) and can be ignored (usually). I don't think this is the reason for the Non-Exit.
The reason will be a (RC-WinTrans) COM object which has not been released.

Possible reasons:
1. you have requested an object from RC-WinTrans and it has not been release before unsing Exit().
Release the object first.

2. a "for .. each ..." loop (.NET) causes this problem. It produces the same problem as (1).
The loop must be realized/coded in a different way. I can help how to do.

Find out which code executed prevents RC-WinTrans to exit. Skip code until RC-WinTrans closes with Exit().

I checked once again the Exit() works for V9. I used a .NET C# as well as a C++ sample application.

Regards,
Support, Schaudin.com
0 permalink
20.12.2013 08:42:26

Kamesh
Kamesh
Posts: 7
This is the snippet which is causing error.

public void CloseWinTrans()
{
if (m_rwtApplication != null)
{

// Determine Temp directory used by WinTrans. This is needed to cleanup
// residual files left by WinTrans after it exits.
string tempDirectory = m_rwtApplication.Tools.DirectoryTool.GetTempDirectory();
try
{
// Exit WinTrans
m_rwtApplication.Exit();
}
catch
{
// Ignore all exceptions on exit.
}

m_rwtApplication = null;

// Delete WinTrans residual files in temp directory.
if (tempDirectory != null)
{
string[] tempFileList = Directory.GetFiles(tempDirectory, "RWTTmpFile_*.resx");
foreach (string filename in tempFileList)
{
File.SetAttributes(filename, FileAttributes.Normal);
File.Delete(filename);
}
}
}
}

The error in Event Viewer is
Application: CreateResourcesAllLanguages.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.NullReferenceException
Stack:
at CreateResourcesAllLanguages.WinTrans.CloseWinTrans()
at CreateResourcesAllLanguages.Program.ExecuteWintransOnDir(System.String)
at CreateResourcesAllLanguages.Program.CallWintransOnDir(System.String)
at CreateResourcesAllLanguages.Program.CallWintransOnDir(System.String)
at CreateResourcesAllLanguages.Program.CallWintransOnDir(System.String)
at CreateResourcesAllLanguages.Program.Main(System.String[])

The same code works fine with RCWintrans 8 but giving up after translating 1st RWT project in case of RCWintrans 9. So I am wondering if anything changed as part of RCWintrans 9
0 permalink
28.12.2013 19:53:01

Support
Support
Administrator
Posts: 245
It can be reproduced using your code.

There is an unhandled exception when you delete the file in the temp dir:
File.Delete(filename);
"An unhandled exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll"

Remove this code and it works.

Note: RC-WinTrans removes all temporary files in this folder on exit.
You do not need to clear the temp RC-WinTrans directory. It is done by RC-WinTrans.


Regards,
Support, Schaudin.com
0 permalink
30.12.2013 09:43:34

Kamesh
Kamesh
Posts: 7
Sure I will try your solution. But I am just curious as to why it was working fine with RCWintrans 8 and causing error only in case RC Wintran 9.3 ?
0 permalink

Home » RC-WinTrans Support » RC-WinTrans 9.3 Wintrans.Exit() not working





Powered by AspNetForum 6.9.6.0 © 2006-2010 Jitbit Software