Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

System.Runtime.InteropServices.SEHException

Discussion in 'Windows' started by nikigter, Nov 21, 2013.

  1. nikigter

    nikigter

    Joined:
    Jul 5, 2013
    Posts:
    4
    I use version is 4.3.0f4 and sometimes receive the following Exception:

    System.Runtime.InteropServices.SEHException was unhandled by user code
    Message: An exception of type 'System.Runtime.InteropServices.SEHException' occurred in UnityEngineProxy.DLL but was not handled in user code
    Additional information: External component has thrown an exception.

    With the debugger from VS 2013 the exception rises in OnGUI() method.
    Code (csharp):
    1.  
    2. GUILayout.Label ("" + maxGuleCountBeforeGameEnd, guleLabelStyle);
    3.  
    maxGuleCountBeforeGameEnd is a private int variable.
     
  2. nikigter

    nikigter

    Joined:
    Jul 5, 2013
    Posts:
    4
    The exception rises again. Here is the UnityPlayer.log

    Build from '' branch, version is '4.3.0f4 (e01000627d60)' (Release build).
    Physical memory: 898 MB, commited memory limit: 380 MB.
    PlayerConnection initialized from C:/Data/Programs/{8ED7A2BE-C28F-4617-AD14-6D61AA4147C7}/Install/Data (debug = 0)
    PlayerConnection initialized network socket : 0.0.0.0 55347
    GetLocalIP: Error during connect, 10065 Multi-casting "[IP] 127.0.0.1 [Port] 55347 [Flags] 2 [Guid] 907637971 [EditorId] 2328478545 [Version] 1048832 [Id] WP8Player(0.0.0.0) [Debug] 0" to [225.0.0.222:54997]...
    Direct3D:
    Version: Direct3D 11.0 [level 9.3]
    Renderer: Qualcomm Adreno 225 (WDDM v1.2) (ID=0x32303032)
    Vendor: Qualcomm
    VRAM: 96 MB
    Initialize engine version: 4.3.0f4 (e01000627d60)
    UnloadTime: 63.420444 ms
    Unloading 4 Unused Serialized files (Serialized files now loaded: 0 / Dirty serialized files: 0)

    Unloading 50 unused Assets to reduce memory usage. Loaded Objects now: 157. Operation took 70.562218 ms.
    System memory in use: 1.9 MB.
    UnloadTime: 9.386518 ms
    Unloading 2 Unused Serialized files (Serialized files now loaded: 0 / Dirty serialized files: 0)

    Unloading 12 unused Assets to reduce memory usage. Loaded Objects now: 133. Operation took 42.078369 ms.
    System memory in use: 2.0 MB.
    UnloadTime: 1.511111 ms
    Unloading 5 Unused Serialized files (Serialized files now loaded: 0 / Dirty serialized files: 0)

    Unloading 12 unused Assets to reduce memory usage. Loaded Objects now: 324. Operation took 18.308001 ms.
    System memory in use: 4.0 MB.
    UnloadTime: 4.503555 ms
    Unloading 2 Unused Serialized files (Serialized files now loaded: 0 / Dirty serialized files: 0)

    Unloading 4 unused Assets to reduce memory usage. Loaded Objects now: 308. Operation took 18.383852 ms.
    System memory in use: 3.9 MB.
    UnloadTime: 7.109185 ms
    Unloading 2 Unused Serialized files (Serialized files now loaded: 0 / Dirty serialized files: 0)

    Unloading 4 unused Assets to reduce memory usage. Loaded Objects now: 308. Operation took 22.587259 ms.
    System memory in use: 3.9 MB.
    UnloadTime: 4.908148 ms
    Unloading 2 Unused Serialized files (Serialized files now loaded: 0 / Dirty serialized files: 0)

    Unloading 4 unused Assets to reduce memory usage. Loaded Objects now: 308. Operation took 11.442962 ms.
    System memory in use: 3.9 MB.
    UnloadTime: 6.561629 ms
    Unloading 2 Unused Serialized files (Serialized files now loaded: 0 / Dirty serialized files: 0)

    Unloading 4 unused Assets to reduce memory usage. Loaded Objects now: 308. Operation took 31.959999 ms.
    System memory in use: 3.9 MB.
    UnloadTime: 9.089333 ms
    Unloading 2 Unused Serialized files (Serialized files now loaded: 0 / Dirty serialized files: 0)

    Unloading 56 unused Assets to reduce memory usage. Loaded Objects now: 135. Operation took 45.738369 ms.
    System memory in use: 2.0 MB.
    UnloadTime: 1.928000 ms
    Unloading 6 Unused Serialized files (Serialized files now loaded: 0 / Dirty serialized files: 0)

    Unloading 9 unused Assets to reduce memory usage. Loaded Objects now: 388. Operation took 75.460892 ms.
    System memory in use: 4.0 MB.
    UnloadTime: 13.233629 ms
    Unloading 3 Unused Serialized files (Serialized files now loaded: 0 / Dirty serialized files: 0)

    Unloading 59 unused Assets to reduce memory usage. Loaded Objects now: 144. Operation took 172.810074 ms.
    System memory in use: 2.0 MB.
    UnloadTime: 2.175111 ms
    Unloading 5 Unused Serialized files (Serialized files now loaded: 0 / Dirty serialized files: 0)

    Unloading 12 unused Assets to reduce memory usage. Loaded Objects now: 397. Operation took 29.994370 ms.
    System memory in use: 4.0 MB.
    UnloadTime: 7.828741 ms
    Unloading 2 Unused Serialized files (Serialized files now loaded: 0 / Dirty serialized files: 0)

    Unloading 4 unused Assets to reduce memory usage. Loaded Objects now: 381. Operation took 12.689185 ms.
    System memory in use: 4.0 MB.
    UnloadTime: 28.816000 ms
    Unloading 2 Unused Serialized files (Serialized files now loaded: 0 / Dirty serialized files: 0)

    Unloading 4 unused Assets to reduce memory usage. Loaded Objects now: 381. Operation took 11.450370 ms.
    System memory in use: 4.0 MB.
    UnloadTime: 7.732444 ms
    Unloading 2 Unused Serialized files (Serialized files now loaded: 0 / Dirty serialized files: 0)

    Unloading 4 unused Assets to reduce memory usage. Loaded Objects now: 381. Operation took 20.078667 ms.
    System memory in use: 4.0 MB.
    UnloadTime: 13.206223 ms
    Unloading 2 Unused Serialized files (Serialized files now loaded: 0 / Dirty serialized files: 0)

    Unloading 4 unused Assets to reduce memory usage. Loaded Objects now: 381. Operation took 11.356000 ms.
    System memory in use: 4.0 MB.
    UnloadTime: 14.758074 ms
    Unloading 2 Unused Serialized files (Serialized files now loaded: 0 / Dirty serialized files: 0)

    Unloading 59 unused Assets to reduce memory usage. Loaded Objects now: 134. Operation took 126.881477 ms.
    System memory in use: 2.0 MB.
    UnloadTime: 1.848888 ms
    Unloading 8 Unused Serialized files (Serialized files now loaded: 0 / Dirty serialized files: 0)

    Unloading 8 unused Assets to reduce memory usage. Loaded Objects now: 382. Operation took 30.119852 ms.
    System memory in use: 4.0 MB.
    UnloadTime: 40.808296 ms
    Unloading 2 Unused Serialized files (Serialized files now loaded: 0 / Dirty serialized files: 0)

    Unloading 63 unused Assets to reduce memory usage. Loaded Objects now: 137. Operation took 56.858814 ms.
    System memory in use: 2.0 MB.
    UnloadTime: 1.410962 ms
    Unloading 8 Unused Serialized files (Serialized files now loaded: 0 / Dirty serialized files: 0)

    Unloading 7 unused Assets to reduce memory usage. Loaded Objects now: 382. Operation took 74.344002 ms.
    System memory in use: 4.0 MB.
    UnloadTime: 5.533925 ms
    Unloading 2 Unused Serialized files (Serialized files now loaded: 0 / Dirty serialized files: 0)

    Unloading 63 unused Assets to reduce memory usage. Loaded Objects now: 135. Operation took 98.298813 ms.
    System memory in use: 2.0 MB.
    UnloadTime: 2.971407 ms
    Unloading 6 Unused Serialized files (Serialized files now loaded: 0 / Dirty serialized files: 0)

    Unloading 6 unused Assets to reduce memory usage. Loaded Objects now: 343. Operation took 25.625925 ms.
    System memory in use: 4.0 MB.
    UnloadTime: 7.108148 ms
    Unloading 2 Unused Serialized files (Serialized files now loaded: 0 / Dirty serialized files: 0)

    Unloading 58 unused Assets to reduce memory usage. Loaded Objects now: 135. Operation took 73.494812 ms.
    System memory in use: 2.0 MB.
    UnloadTime: 1.671703 ms
    Unloading 7 Unused Serialized files (Serialized files now loaded: 0 / Dirty serialized files: 0)

    Unloading 6 unused Assets to reduce memory usage. Loaded Objects now: 416. Operation took 21.327406 ms.
    System memory in use: 4.0 MB.
    Exception: External component has thrown an exception.
    Type: System.Runtime.InteropServices.SEHException
    Module: UnityEngineProxy
    InnerException: <No Data>
    AdditionalInfo:Invoking UnityEngine.GUIUtility::BeginGUI method with argument count: 3
    at UnityEngineProxy.InternalCalls.RectOffset_Get_Custom_PropLeft(Object self)

    at UnityEngine.GUILayoutGroup.ApplyStyleSettings(GUIStyle style)

    at UnityEngine.GUILayoutEntry..ctor(Single _minWidth, Single _maxWidth, Single _minHeight, Single _maxHeight, GUIStyle _style)

    at UnityEngine.GUILayoutGroup..ctor()

    at UnityEngine.GUILayoutUtility.Begin(Int32 instanceID)

    at UnityEngine.GUIUtility.BeginGUI(Int32 skinMode, Int32 instanceID, Int32 useGUILayout)

    at lambda_method(Closure , Object , Object[] , Int32 )

    at WinRTBridge.MethodTools.InvokeMethod(Object instance, Int32 methodIndex, Object[] args)

    (Filename: C:/BuildAgent/work/d3d49558e4d408f4/Runtime/Scripting/WinRTUtility.cpp Line: 65)

    UnloadTime: 14.902814 ms
    Unloading 2 Unused Serialized files (Serialized files now loaded: 0 / Dirty serialized files: 0)

    Unloading 56 unused Assets to reduce memory usage. Loaded Objects now: 139. Operation took 29.829628 ms.
    System memory in use: 2.1 MB.
    UnloadTime: 1.315703 ms
    Unloading 6 Unused Serialized files (Serialized files now loaded: 0 / Dirty serialized files: 0)

    Unloading 6 unused Assets to reduce memory usage. Loaded Objects now: 337. Operation took 72.726669 ms.
    System memory in use: 4.0 MB.
     
  3. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,526
    Hello. This is a known issue and are working at getting a fix out ASAP. Until then, the best you can do it wait...
     
  4. andrydeen

    andrydeen

    Joined:
    Aug 11, 2012
    Posts:
    37
    Hi i have the same problem , do you have any news ?
     
  5. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,526
    Hi, this issue was fixed in Unity 4.3.2.
     
  6. taxvi

    taxvi

    Joined:
    Feb 18, 2013
    Posts:
    30
    after reading this I updated from 4.3.0 to 4.5.4 but all the same.
    I'm testing on Huawei W1 U-34 phone, with Windows Phone 8.0
     
  7. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,526
    Hi,

    could you go into more details?
     
  8. taxvi

    taxvi

    Joined:
    Feb 18, 2013
    Posts:
    30
    the source of error is Input.GetTouch(0). If this helps I found a work-around by Input.simulateMouseWithTouches = true and interact with the game through an imaginary mouse. But when I was using the Input.GetTouch the error was repeated quite a number of times:

    Code (csharp):
    1.  
    2. Exception: External component has thrown an exception
    3. Type:
    4. System.Runtime.InteropServices.SEHException
    5. Module: UnityEngine
    6. InnerException: <No Data>
    7. AdditionalInfo: <No Data>
    8. at UnityEngine.Internal.$Calli.Invoke28(Int32 arg0, Int32 arg1, IntPtr method)
    9. at UnityEngine.Input.GetTouch(Int32 index)
    10. at Controlls.DetectInputs()
    11. at Controlls.$Invoke7(Int64 instance, Int64* args)
    12. at UnityEngine.Internal.$MethodUtility.InvokeMethod(Int64 instance, Int64* args, IntPtr method)
    13.  
    14. SEHException: External component has thrown an exception.
    15.  
    I just discovered that even though the error is there, the touches actually do work (yesterday the log was covering the target touch area) but the error is still there
     
    Last edited: Oct 4, 2014
  9. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,692
    Please check if Input.touchCount bigger than 0, and if it is, only then call Input.GetTouch(0), you're probably accessing non existant data.
     
  10. taxvi

    taxvi

    Joined:
    Feb 18, 2013
    Posts:
    30
    Tomas1856
    Thank you, that solved it.
     
    anubhav756 likes this.
  11. sathya

    sathya

    Joined:
    Jul 30, 2012
    Posts:
    286
    Exception: External component has thrown an exception.
    Type: System.Runtime.InteropServices.SEHException
    Module: UnityEngine
    InnerException: <No Data>
    AdditionalInfo:<No Data>
    at UnityEngine.Internal.$Calli.Invoke39(Int32 arg0, IntPtr method) at UnityEngine.Component.InternalGetGameObject() at ProFlareBatch.OnDestroy() at ProFlareBatch.$Invoke7(Int64 instance, Int64* args) at UnityEngine.Internal.$MethodUtility.InvokeMethod(Int64 instance, Int64* args, IntPtr method)

    @ProFlares
    Facing same SEHException in Proflare as well. Its killing the app on launch itself. how can i resolve this
     
  12. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,692
    It seems, you're calling gameObject property on object which no longer exists in ProFlareBatch.OnDestroy function.

    Check if object isn't null.
     
  13. sathya

    sathya

    Joined:
    Jul 30, 2012
    Posts:
    286
    And Facing the same issue if following script as well. Checking for null here as well but still same issue pops up and kills the app
    Code (CSharp):
    1. public class FlickeringLight : MonoBehaviour
    2. {
    3.  
    4.     public Material currentShader;
    5.     public float minValue = 0.5f;
    6.     public float maxValue = 1.5f;
    7.     public float interval = 0.5f;
    8.  
    9.     void Start () {
    10.       //  if (Game.isHD)
    11.         StartCoroutine("FlickerLight");
    12.     }
    13.  
    14.    private IEnumerator FlickerLight()
    15.     {
    16.         if (currentShader)
    17.         {
    18.             yield return new WaitForSeconds(interval);
    19.             FlickerShaer(currentShader, minValue);
    20.             yield return new WaitForSeconds(interval);
    21.             FlickerShaer(currentShader, maxValue);
    22.             StartCoroutine("FlickerLight");
    23.         }
    24.     }
    25.  
    26.    private void FlickerShaer(Material shader, float value)
    27.    {
    28.        try
    29.        {
    30.            shader.SetFloat("_Intensity", value);
    31.        }
    32.        catch
    33.        {
    34.        }
    35.    }
     
  14. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,692
    This is not ProFlareBatch class?
     
  15. sathya

    sathya

    Joined:
    Jul 30, 2012
    Posts:
    286
  16. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,526
    No, that issue affected only scripts in UnityScript.
     
  17. sathya

    sathya

    Joined:
    Jul 30, 2012
    Posts:
    286
    oh k. Can you see anything bad in FlickeringLight class ! Which may be the cause for SEHException.
     
  18. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,526
    That script looks fine.. on which line does the exception happen?
     
  19. anubhav756

    anubhav756

    Joined:
    Mar 25, 2014
    Posts:
    6
    Received the same error while building my game for windows store. I'm using unity 5.

    I'm receiving the error at line:

    GameObject[] allSpheres = GameObject.FindObjectsWithTag("sphere");

    this function is called many times rapidly in the game, and the VS debugger says at the break point that the allSpheres variable is null. So, I declared the variable outside the function, so that it is initialized just ones.

    GameObject[] allSpheres;

    ......


    allSpheres = GameObject.FindObjectsWithTag("sphere");

    but no luck :(

    The details of my error is as follows:


    System.Runtime.InteropServices.SEHException was unhandled by user code
    HResult=-2147467259
    Message=External component has thrown an exception.
    Source=UnityEngineProxy
    ErrorCode=-2147467259
    StackTrace:
    at UnityEngineProxy.InternalCalls.GameObject_CUSTOM_FindGameObjectsWithTag(String tag)
    at UnityEngine.GameObject.FindGameObjectsWithTag(String tag)
    at gameManager.checkWinner()
    at gameManager.turnEnds()
    at gameManager.Update()
    at gameManager.$Invoke14(Int64 instance, Int64* args)
    at UnityEngine.Internal.$MethodUtility.InvokeMethod(Int64 instance, Int64* args, IntPtr method)
    InnerException:




    Let me know if u want any other details regarding this.... But please help ASAP :'(
     
    Last edited: Apr 10, 2015
  20. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,664
    I'd suggest to wrap it with you own function and make sure allSpheres is never null. Like this:
    Code (CSharp):
    1. GameObject[] FindAllSpheres()
    2. {
    3.     var spheres = GameObject.FindObjectsWithTag("sphere");
    4.     return spheres!=null ? spheres : new GameObject[]{};
    5. }
    6.  
    and use this function to get spheres. If that does not help, please report a bug.
     
    anubhav756 likes this.
  21. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,526
  22. anubhav756

    anubhav756

    Joined:
    Mar 25, 2014
    Posts:
    6
    Yes, I declared the "sphere" tag.

    Also, I tried the wrapper function suggested by Aurimas, but the error then pointed to the GameObject.GetGameObjectsWithTag("sphere") line in that function itself!

    So, I decided to work my way round by using alternatives of this method. I used GameObject.GetObjectsWithComponent<sphereBehaviour>() to get a list of all sphereBehaviour component which was attached to each sphere, and then grabbed the respective sphere GameObjects by myScript.gameObject property. But I ended up crashing unity every time I reached that line of code (don't know y! So, another bug here)

    Finally, I used an ArrayList of sphere GameObjects, which I incorporated into the whole game, to maintain that list, throughout the lifetime of the game, and then used it to get the list of all spheres......Finally!

    Yep, Unity has these two bugs (or maybe one, if they have the same root cause), which needs to be reported, and figured out ASAP

    But, anyways guys....Thanks alot :)
     
  23. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,526
    Can you file those bugs reports with a repro projects attached?
     
  24. anubhav756

    anubhav756

    Joined:
    Mar 25, 2014
    Posts:
    6
    sorry....

    can you please explain this step wise?
     
  25. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,526