UnityPlayer crashes on Windows Phone 8 - windows-phone-8

Facing the crash while debugging the application on Windows Phone 8 (Nokia Lumia 520), and I cannot figure out why. The game is developed in Unity, targeting iOS and Android at first, and now being ported to WP8. The failure occurs before stepping into my scripts, and UnhandledException handler also isn't reached.
Debugger (Native Only) is set to break when exception is thrown and user-unhandled. At first time call stack is:
KERNELBASE.DLL!RaiseException() Unknown
coreclr.dll!RaiseTheExceptionInternalOnly(class Object *,int,int) Unknown
coreclr.dll!UnwindAndContinueRethrowHelperAfterCatch(class Frame *,class Exception *) Unknown
coreclr.dll!AssemblyNative::GetType(struct QCall::AssemblyHandle,unsigned short const *,int,int,struct QCall::ObjectHandleOnStack) Unknown
mscorlib.ni.dll!702d7056() Unknown
mscorlib.ni.dll!702d7056() Unknown
mscorlib.ni.dll!702d7056() Unknown
...
(Cannot load mscorlib.ni.pdb, so stack frames are not symbolized).
Right after next break call stack contains:
KERNELBASE.DLL!RaiseException() Unknown
Msvcr110.dll!_CxxThrowException(void * pExceptionObject=0x06a9fc24, const _s__ThrowInfo * pThrowInfo) Line 152 C++
Vccorlib110.dll!__abi_WinRTraiseCOMException(long hr=-2146234304) Line 502 C++
UnityPlayer.dll!ScriptingTypeProvider_Metro::NativeTypeFor(const char * namespaze=0x05f2d228, const char * name=0x05ba0aa0) Line 29 C++
UnityPlayer.dll!ScriptingTypeRegistry::GetType(const char * namespaze=0x06a9fd88, const char * name=0x05f2d2ac) Line 19 C++
UnityPlayer.dll!MonoScript::RebuildFromAwake() Line 149 C++
UnityPlayer.dll!PersistentManager::LoadFileCompletelyThreaded(const std::basic_string<char,std::char_traits<char>,stl_allocator<char,51,4> > & pathname={...}, int * fileIDs=0x06a9fec8, int * instanceIDs=0x00010004, int size=-1, bool loadScene=false, LoadProgress * loadProgress=0x06a9fec8) Line 1452 C++
UnityPlayer.dll!PreloadLevelOperation::Perform() Line 652 C++
UnityPlayer.dll!PreloadManager::Run() Line 235 C++
UnityPlayer.dll!PreloadManager::Run(void * managerPtr=0x03d91540) Line 187 C++
UnityPlayer.dll!Thread::RunThreadWrapper(void * ptr=0xfffffffe) Line 44 C++
UnityPlayer.dll!<lambda_14163fd8e7b3473ba35abd0bcfa8d126>::operator()(Windows::Foundation::IAsyncAction ^ __formal=0x05be84a8) Line 273 C++
UnityPlayer.dll!Windows::System::Threading::WorkItemHandler::[Windows::System::Threading::WorkItemHandler::__abi_IDelegate]::__abi_Windows_System_Threading_WorkItemHandler___abi_IDelegate____abi_Invoke(Windows::Foundation::IAsyncAction ^ __param0=0x03d91528) C++
THREADPOOLWINRT.DLL!Windows::System::Threading::CThreadPoolWorkItem::CommonWorkCallback(void) Unknown
THREADPOOLWINRT.DLL!Windows::System::Threading::CThreadPoolWorkItem::TimeSlicedCallback(void *) Unknown
NTDLL.DLL!RtlUserThreadStart() Unknown
And the output says:
First-chance exception at 0x77271ECF in TaskHost.exe: Microsoft C++ exception: Platform::COMException ^ at memory location 0x06A9FC24. HRESULT:0x80131040
If I correctly interpret Google results for "HRESULT:0x80131040" it's often associated with message "The located assembly's manifest definition does not match the assembly reference." How can I find out what assembly causes the problem? Which ways should I try to investigate this issue?
Environment:
Windows Pro 8.1 64-bit
Unity Pro 4.3.1f1
Microsoft Visual Studio Express 2012 for Windows Phone (supplied with Windows Phone SDK 8.0)
Related question: http://answers.unity3d.com/questions/595091/windows-phone-8-debugger.html
Any help would be very much appreciated!

Tautvydas Zilys surmised that the cause was mismatch between versions of assemblies of the same name that targeted different platforms; and he was right.

Related

ScriptControl doesn't work on VBA json parser in 64bit excel? [duplicate]

Is there any msscript control in 64 bit?
I google a bit and all say no 64-bit yet
The reason that I need 64bit msscript.ocx is that I want to compile delphi projects in 64-bit using XE3.
It compiles OK in XE3 and I have obtained a 64-bit exe but when it executes to the following line,
script := TScriptControl.Create(nil);
It gives me a 'Class Not Registered' error. I only found msscript.ocx under C:\windows\SysWOW64 but there is no such file under System32 folder.
I really want this to work so any quick replacement for this?
This is an old post. but I just found a very good alternative to 64-bit MSScript Control (Microsoft does not have 64-bit msscript.ocx)
http://www.eonet.ne.jp/~gakana/tablacus/scriptcontrol_en.html
and I have changed only a few lines of code in my application and it works in 64-bit based on this ScriptControl64.
The msscript component was not ported to 64 bit. It's a legacy component and MS chose not to put the effort into migrating it to 64 bit. You'll simply need to find another way to do whatever it is you do with that component.
I faced the same issue porting an c++ application from 32 to 64 Bit.
I know that this question was raised on Delphi but I hope someone can make use of this information or transfer it to other languages.
We where initiating the "ScriptControl" (MSScriptControl.ScriptControl.1) via CreateDispatch.
The control info is located in Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ScriptControl
and we executed VBS or JScript with this MS control in 32 Bit:
COleDispatchDriver* m_dispScriptControl = new COleDispatchDriver();
if (m_dispScriptControl)
{
if (m_dispScriptControl->CreateDispatch(_T("ScriptControl")))
{
...
.... setting language to be used and other proteries .. then execute script code:
_variant_t varResult;
VariantClear(&varResult);
EXCEPINFO excepinfo;
VARIANT parameters;
parameters.vt = VT_BSTR;
parameters.bstrVal = strScriptCodeWCHAR;
DISPPARAMS dispparams;
dispparams.rgdispidNamedArgs = NULL;
dispparams.cNamedArgs = 0;
dispparams.cArgs = 1;
dispparams.rgvarg = &parameters;
unsigned int uArgErr = 0;
if (S_OK != m_dispScriptControl->m_lpDispatch->Invoke(0x7d2, IID_NULL, LOCALE_SYSTEM_DEFAULT, DISPATCH_METHOD, &dispparams, &varResult, &excepinfo, &uArgErr))
...
}
After some research it seems not to be possible to create the
ScriptControl in 64 bit application as of a MSDN query:
Question was: I have window forms application currently working fine
on 32 Bit Application and i am investigation so we can install it on a
64 bit computer but getting on lauching the application as below.
Class not registered (Exception from HRESULT: 0x80040154
(REGDB_E_CLASSNOTREG))
The error is located on AxInterop.MSScriptControl.dll
Awnser is: If it ONLY lives in C:\Windows\SysWOW64, then your .Net
application cannot run in 64-bit mode. Make sure you compile it for
x86 instead of Any CPU. Then you'll be able to use it in 64-bit
Windows, but it will be a 32-bit process.
https://social.msdn.microsoft.com/Forums/windows/en-US/1e9ddfe4-3408-4a34-ba43-a1a0931daebd/64-bit-windows-7?forum=clr
With which we where not happy as we want to run as 64-bit process
Our solution was to use the Microsoft IActiveScript Interface. And implemented the same on our main window:
BEGIN_INTERFACE_PART(ActiveScriptSite, IActiveScriptSite)
STDMETHOD(GetLCID)(LCID*);
STDMETHOD(GetItemInfo)(LPCOLESTR, DWORD, LPUNKNOWN*, LPTYPEINFO*);
STDMETHOD(GetDocVersionString)(BSTR*);
STDMETHOD(OnScriptTerminate)(const VARIANT*, const EXCEPINFO*);
STDMETHOD(OnStateChange)(SCRIPTSTATE);
STDMETHOD(OnScriptError)(IActiveScriptError*);
STDMETHOD(OnEnterScript)();
STDMETHOD(OnLeaveScript)();
END_INTERFACE_PART(ActiveScriptSite)
Now when we have to execute script code we do the following, which works fine in 64 and 32 BIT versions of our built:
CString strLanguage;
if (nLanguage == 1)
{
strLanguage = _T("VBScript");
}
else
{
strLanguage = _T("JScript");
}
CComPtr<IActiveScript> m_pAxsScript;
HRESULT hr = m_pAxsScript.CoCreateInstance(CT2W(strLanguage), NULL, CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER);
m_pAxsScript->SetScriptSite(&m_xActiveScriptSite); //m_xActiveScriptSite is a member of the interface
CComQIPtr<IActiveScriptParse> m_pAxsScriptParse = m_pAxsScript;
m_pAxsScriptParse->InitNew();
EXCEPINFO pException = { 0 };
hr = m_pAxsScriptParse->ParseScriptText(_bstr_t(strCode), 0, NULL, NULL, dw, 0, 0, NULL, &pException);
//execute script
m_pAxsScript->SetScriptState(SCRIPTSTATE_CONNECTED);
m_pAxsScriptParse.Release();
m_pAxsScriptParse = nullptr;
hr = m_pAxsScript->SetScriptState(SCRIPTSTATE_DISCONNECTED);
ASSERT(hr == S_OK);
m_pAxsScript->Close();
m_pAxsScript.Release();

How to call Output Menu Item and execute Report in Batch Mode?

I have an issue in BATCH mode.
If I call this line command:
Args parameters = new Args();
MenuFunction menuFunction;
parameters.record(myCurrentTableRecord);
parameters.caller(this);
menuFunction = new MenuFunction(menuitemoutputstr(Report_Name), MenuItemType::Output);
menuFunction.run(parameters);
in Client mode, it work well. Generate the report.
If I execute this command in BATCH mode I get an error like this:
An exception of type 'System.InvalidCastException' occurred in Dynamics.Ax.Application.dll26.netmodule but was not handled in user code
System.InvalidCastException: Unable to cast object of type 'Dynamics.Ax.Application.Report_NameContract' to type 'Dynamics.Ax.Application.TradeDocumentReportContract'.
at
Dynamics.Ax.Application.TradeDocumentReportController.Prerunmodifycontract() in TradeDocumentReportController.preRunModifyContract.xpp:line 8
at Dynamics.Ax.Application.SrsPrintMgmtController.Outputreports() in SrsPrintMgmtController.outputReports.xpp:line 65
at Dynamics.Ax.Application.ReportName.Runprintmgmt() in Report_Name.runPrintMgmt.xpp:line 28
at Dynamics.Ax.Application.SrsPrintMgmtController.Run() in SrsPrintMgmtController.run.xpp:line 30
at Dynamics.Ax.Application.SysOperationController.Startoperation() in SysOperationController.startOperation.xpp:line 10
at Dynamics.Ax.Application.SrsReportRunController.Startoperation() in SrsReportRunController.startOperation.xpp:line 19
at Dynamics.Ax.Application.SrsPrintMgmtController.Startoperation() in SrsPrintMgmtController.startOperation.xpp:line 14
at Dynamics.Ax.Application.SrsPrintMgmtFormLetterController.Startoperation() in SrsPrintMgmtFormLetterController.startOperation.xpp:line 14
at Dynamics.Ax.Application.Report_Name.main(Args _args) in Report_Name.main.xpp:line 14
The Class used to define my Report extends the TradeDocumentReportController class.
I executed a Full CIL , restarted my AOS/Report Services etc...
There is any way to execute the report in BACTH Mode? Have I to pass any parameters?
Thanks in advice.
Enjoy.
From the looks of it, Report_NameContract doesn't extend TradeDocumentReportContract.
It might be a good idea for you to debug the batch job using Visual Studio by attaching to process Ax32Serv.exe, if you want to see what exactly is going on and where the process doesn't work as expected.

How to force gfortran to stop at First NaN?

My Configuration: Cygwin64, Win7 64 bit, gfortran 4.8.3
I did go through all the Q/A pairs I managed to find, this one is the closest to my problem
Force gfortran to stop program at first NaN
PROBLEM: The fortran code
real :: init_with_NaN ! -finit-real=nan
res = 10 * init_with_NaN
The code is compiled with the following gfortran flags
COLLECT_GCC_OPTIONS='-funderscoring' '-O0' '-g' '-c' '-fmessage-length=0' '-O0' '-g' '-ffpe-trap=invalid,zero,overflow,underflow,precision,denormal' '-Wall' '-c' '-fmessage-length=0' '-Wpedantic' '-std=f2003' '-fall-intrinsics' '-fbacktrace' '-fimplicit-none' '-Wextra' '-Wformat=1' '-Wconversion' '-Wfatal-errors' '-finit-real=nan' '-Wuninitialized' '-fbounds-check' '-v' '-o' 'fsignal_test.o' '-mtune=generic' '-march=x86-64'
Once the code is run, instead of getting a SIGFPE, res is set to be NaN and execution continues.
This is a sub-problem of a million dollar question:
Does gfortran -ffpe-trap=invalid flag really stops the program once it detects a NaN anywhere in the program ? Especially on Cygwin64 env?
A little research showed that:
1) Acc.to https://gcc.gnu.org/onlinedocs/gfortran/Debugging-Options.html, -ffpe-trap works on MOST systems, not all :(
2) Acc. to Division by zero does not throw SIGFPE
"You don't get a signal because the default behavior on most machines
is to pollute your data with NaNs (not-a-number) and infinities. You
have to enable floating point exceptions, and how you do that is
machine specific. Look at the system header fenv.h, if you have one.
The function fesettrapenable enables catching floating point
exceptions on many machines.
Unfortunately, there is no standard function to turn floating point
exceptions handling on"
3) I have checked my cygwin env, fenv.h exists in multiple places but there is no fesettrapenable function anywhere under any *.h file under cygwin64.
4) I do get SIGFPEs: like sqrt(-1), div by zero, overflow, underflow, precision
Here is the full Fortran test project in Eclipse, use it at your hearts content to learn about exceptions on your own platform:
https://drive.google.com/file/d/0B9U1dlb_UCPqU194XzhDNTNkUUU/view?usp=sharing

Win 8.1 App crashes on user device - How to debug?

last week I published my first Windows 8.1 app on the Windows Store. So far everything works fine but now two user reported that the app crashes immediately when being launched.
Additionally I discovered that there is a CrashDump listed in the Reports/Quality section of the Dashboard. I dowloaded the CrashDump and tried to find the source of the problem using WinDbg by following this instruction: http://blogs.msdn.com/b/ntdebugging/archive/2014/01/13/debugging-a-windows-8-1-store-app-crash-dump.aspx
I was able to follow the instruction almost up to the end but then the sos library is not found:
0:006> .sympath SRV*C:\Symbols*http://msdl.microsoft.com/download/symbols
...
0:006> .exr -1
ExceptionAddress: 769eb1d7 (combase+0x000fb1d7)
ExceptionCode: c000027b
ExceptionFlags: 00000001
NumberParameters: 2
Parameter[0]: 03f3f32c
Parameter[1]: 00000001
0:006> !error c000027b
Error code: (NTSTATUS) 0xc000027b (3221226107) - Anwendungsinterne Ausnahme.
0:006> .ecxr
eax=03f3f030 ebx=00000000 ecx=00000000 edx=00000000
esi=03f3f360 edi=03f3f030 eip=769eb01f esp=03f3f314
ebp=03f3f3bc iopl=0 nv up ei pl nz ac po nc cs=001b
ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000212
combase+0xfb01f: 769eb01f 6a03 push 3
0:006> knL
*** Stack trace for last set context - .thread/.cxr resets it
...
0:006> dt 03f3f32c combase!_STOWED_EXCEPTION_INFORMATION_HEADER*
0x05f182e4
+0x000 Size : 0x28
+0x004 Signature : 0x53453032
0:006> .formats 0x53453032
Evaluate expression:
Hex: 53453032
Decimal: 1397043250
Octal: 12321230062
Binary: 01010011 01000101 00110000 00110010
Chars: SE02
Time: Wed Apr 09 13:34:10 2014
Float: low 8.46917e+011 high 0
Double: 6.90231e-315
0:006> dt -a1 03f3f32c combase!_STOWED_EXCEPTION_INFORMATION_V2*
[0] # 03f3f32
---------------------------------------------
0x05f182e4
+0x000 Header : _STOWED_EXCEPTION_INFORMATION_HEADER
+0x008 ResultCode : 80131500
+0x00c ExceptionForm : 0y01
+0x00c ThreadId : 0y000000000000000000010001100101 (0x465)
+0x010 ExceptionAddress : 0x76943bff Void
+0x014 StackTraceWordSize : 4
+0x018 StackTraceWords : 0xa
+0x01c StackTrace : 0x04c6c010 Void
+0x010 ErrorText : 0x76943bff "趍ﯰ???" +0x
+0x020 NestedExceptionType : 0x314f454c
+0x024 NestedException : 0x05f1be44 Void
0:006> !error 80131500
Error code: (HRESULT) 0x80131500 (2148734208) - <Unable to get error code text>
0:006> dpS 0x04c6c010 La 7697a9f1 combase!RoOriginateLanguageException+0x3b [d:\blue_gdr\com\combase\winrt\error\error.cpp # 1083]
63da3bc6 mscorlib_ni+0x9b3bc6
63e41976 mscorlib_ni+0xa51976
63e415c1 mscorlib_ni+0xa515c1
5b72f9df System_Runtime_WindowsRuntime_ni+0x1f9df
5b72f965 System_Runtime_WindowsRuntime_ni+0x1f965
6372de66 mscorlib_ni+0x33de66
5b72f934 System_Runtime_WindowsRuntime_ni+0x1f934
5b6bff16 Windows_UI_ni+0x9ff16
64492a36 clr!COMToCLRDispatchHelper+0x28
0:006> !sos.pe
The call to LoadLibrary(sos) failed, Win32 error 0n2
"The system cannot find the file specified."
Please check your debugger configuration and/or network access.
0:006> .loadby sos clr
The call to LoadLibrary(c:\symbols\clr.dll\52E0B78469b000\sos) failed, Win32 error 0n126
"The system cannot find the file specified."
Please check your debugger configuration and/or network access.
I does not have experience with this kind of debugging and without the instruction I would not have known any of the commands that I had to use in WinDbg.
Does anyone have an idea how to go on from here?
I have uploaded the CrashDump to my OneDrive. Would be great if anyone with more experience could have a look at it:
http://1drv.ms/1gZzrRK
Is it somehow possible to get additional information from the users who reported the crash to the support? Can they extract a crash dump / error report from their systems?
Is there any possibility to supply a changed version to these users to check if these changes influence the problem?
Thank you very much!
In order to get more insight into what your app is doing when it's running on users' devices, you could add logging of some kind. Local logging to file is an option, but a poor one, since you have to let your user dig into hidden files to retreive your application log. It might be acceptable though, depending on your scenario. In that case you might want to look at this logging sample for Windows Store Apps that uses EWT to log.
Alternatives would be using some kind of logging framework. I haven't got any experience in any of those so I couldn't tell you which one to use.
As for getting a changed version to your user: simply build an app-package locally, put it on OneDrive and send them a link to it. They can sideload the app themselves (although it requires running a Powershell script and logging in with a live-account). I've used this approach with several clients and it's workable.

Robot Framework complains SWIG generated python file contains no keywords

I'm using SWIG to generate wrapper from C++ for Robot Framework as test library. RF issues a warning because it contains no keywords.
The system under test is a Win32 DLL, LibLogin2, created by VS wizard. It exports the function by default:
LIBLOGIN2_API int fnLibLogin2(void);
// This is an example of an exported function.
LIBLOGIN2_API int fnLibLogin2(void)
{
return 42;
}
I add interface file to the project:
/* LibLogin2.i */
%module LibLogin2
%{
extern int fnLibLogin2(void);
%}
extern int fnLibLogin2(void);
LibLogin2.py, LibLogin2_warp.cxx, _LibLogin2.pyd are built successfully with Release|x64.
I have a RF test case as follows:
*** Settings ***
Library LibLogin2.py
*** Test Case ***
Trivial
${value} = fnLibLogin2
Should Be Equal ${value} ${42}
I launch Robot Framework and get THE error:
pybot LoginTests.tsv
[ WARN ] Imported library 'LibLogin2.py' contains no keywords
I can work around this by commenting out the last line of LibLogin.py:
def fnLibLogin2():
return _LibLogin2.fnLibLogin2()
#fnLibLogin2 = _LibLogin2.fnLibLogin2
It's annoying when you have to comment out every key word every time.
Please advice!
Here is my configuration:
Windows 8 64-bit
Visual Studio 2012
Python 2.6.6
Robot Framework 2.7.5
swigwin-2.0.8