Set_Identicalcopiesoflabel Issue In Bartender 10.0 Sr2 追蹤

0
Avatar
Legacy Poster

I just installed the BarTender 10.0 SR2, and then suddenly I get some strange errors that I did not have in BarTender 10.0 SR1

The error looks like this :
NAME:
exObject
VALUE:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException: The interface is unknown. (Exception from HRESULT: 0x800706B5)
at BarTender.PrintSetupClass.get_IdenticalCopiesOfLabel()
at Seagull.BarTender.Print.PrintSetup.set_IdenticalCopiesOfLabel(Int32 value)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.Dynamics.AX.ManagedInterop.ClrBridgeImpl.InvokeClrInstanceMethod(ClrBridgeImpl* , ObjectWrapper* objectWrapper, Char* pszMethodName, Int32 argsLength, ObjectWrapper** arguments, Boolean* argsAreByRef, Boolean* isException)
TYPE:
System.Reflection.TargetInvocationException


-----------------
The code I'm running (X++ in Dynamics AX) looks like this :

public void setIdenticalCopies(int _numOfCopies)
{
Seagull.BarTender.Print.PrintSetup printSetup;

this.checkClosed();

if (_numOfCopies < 1)
{
throw error("@BTI142");
}

try
{
printSetup = formatDocument.get_PrintSetup();
if (printSetup.get_SupportsIdenticalCopies())
printSetup.set_IdenticalCopiesOfLabel(_numOfCopies); [size="5"][b]<----------- It fails here[/b][/size]
}
catch (Exception::CLRError)
{
new SysExceptionLog().writeEntry(Exception::Error, AifUtil::getClrErrorMessage(), "@BTI128");
throw error("@BTI143");
}
}

The strange thing, is that is worked perfectly in BarTender 10.0 SR1 ?????

Help ?

2 意見

0
Avatar
Michael Toupin (mtoupin
評論操作 永久連結

[quote name='Kurt' timestamp='1350507823' post='3517']
I just installed the BarTender 10.0 SR2, and then suddenly I get some strange errors that I did not have in BarTender 10.0 SR1

The error looks like this :
NAME:
exObject
VALUE:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException: The interface is unknown. (Exception from HRESULT: 0x800706B5)
at BarTender.PrintSetupClass.get_IdenticalCopiesOfLabel()
at Seagull.BarTender.Print.PrintSetup.set_IdenticalCopiesOfLabel(Int32 value)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.Dynamics.AX.ManagedInterop.ClrBridgeImpl.InvokeClrInstanceMethod(ClrBridgeImpl* , ObjectWrapper* objectWrapper, Char* pszMethodName, Int32 argsLength, ObjectWrapper** arguments, Boolean* argsAreByRef, Boolean* isException)
TYPE:
System.Reflection.TargetInvocationException


-----------------
The code I'm running (X++ in Dynamics AX) looks like this :

public void setIdenticalCopies(int _numOfCopies)
{
Seagull.BarTender.Print.PrintSetup printSetup;

this.checkClosed();

if (_numOfCopies < 1)
{
throw error("@BTI142");
}

try
{
printSetup = formatDocument.get_PrintSetup();
if (printSetup.get_SupportsIdenticalCopies())
printSetup.set_IdenticalCopiesOfLabel(_numOfCopies); [size="5"][b]<----------- It fails here[/b][/size]
}
catch (Exception::CLRError)
{
new SysExceptionLog().writeEntry(Exception::Error, AifUtil::getClrErrorMessage(), "@BTI128");
throw error("@BTI143");
}
}

The strange thing, is that is worked perfectly in BarTender 10.0 SR1 ?????

Help ?
[/quote]

Hello,

We have tested this in our internal copy of AX, and we aren't able to reproduce this situation. Can you give me a little more information, specifically what version of AX and what OS you are using? As well, did you change the reference to the latest DLL file, and did you recompile after doing that?
0
Avatar
Legacy Poster
評論操作 永久連結

[quote name='Mike T - Seagull Support' timestamp='1351114118' post='3580']
Hello,

We have tested this in our internal copy of AX, and we aren't able to reproduce this situation. Can you give me a little more information, specifically what version of AX and what OS you are using? As well, did you change the reference to the latest DLL file, and did you recompile after doing that?
[/quote]

I found the reason, and that is that sometimes I'm showing the barTender Client (when started from the COM/.NET) If the user then exists the bartender, it does not Close the barTender.exe process. So the NeXT time I try to print a label, the AX tries to Connect to a "dead" barTender process. This causes the failure.


Is there a way to start the barTender process from code, show it, and making sure that when the user Closes the barTender Client, then the barTender.exe process is also closed ? It Works like this if you start bartender normally, but not when doing this from code.

Here is a sample code (for AX)
static void Bti_StayAlive(Args _args)
{
InteropPermission permission;
System.Exception e; // declare
Seagull.BarTender.Print.Engine engine;
Seagull.BarTender.Print.EngineSettings EngineSettings;

Seagull.BarTender.Print.Documents documents;
Seagull.BarTender.Print.LabelFormatDocument labelFormatDocument;
Seagull.BarTender.Print.Result result;
Seagull.BarTender.Print.Window win;
;
engineSettings = new Seagull.BarTender.Print.EngineSettings();
engineSettings.set_OpenDocumentIdleTime(2);
engine = new Seagull.BarTender.Print.Engine();

engine.Start();

win = engine.get_Window();
win.set_Visible(true);
documents = engine.get_Documents();
labelFormatDocument = documents.Open("C:\\BTI\\BTISampleLabels\\PickingRouteLarge_192x102.btw");

labelFormatDocument.Activate();
result = labelFormatDocument.Print();
//engine.Stop();
}

Run this, and you see that even after you Closes the barTender Client, the process still runs.
(And strangely it starts to consume a lot of CPU without any reason)

登入寫評論。