Search Unity

Unloading broken assembly error with UnityPurchasing

Discussion in 'Unity IAP' started by Meltdown, Jul 15, 2018.

  1. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,430
    I'm using Unity 2018.2.f02. I'm having this frustrating issue with Unity IAP showing errors in the editor after updating to the latest IAP version.

    Unloading broken assembly Assets/Plugins/UnityPurchasing/Bin/Editor.dll, this assembly can cause crashes in the runtime.

    Unloading broken assembly Assets/Plugins/UnityPurchasing/Bin/Stores.dll, this assembly can cause crashes in the runtime

    Which then of course leads to all sorts of errors such as Assets/Scripts/IAPManager.cs(9,42): error CS0246: The type or namespace name `IStoreListener' could not be found. Are you missing an assembly reference?

    I've completely cleaned out my project and re-imported everything twice now, and I still have this issue.

    How do I fix this?
     
  2. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    6,534
  3. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,430
    It actually seemed to happen after I imported a specific asset from the asset store into my racing game project.

    This asset by default overwrites my project settings, tags and layers etc. so I just unchecked these options and the problem went away.

    Still no idea why it would cause Unity IAP to break though.

    I didn’t test it on a brand new project
     
  4. MichiealO

    MichiealO

    Joined:
    Jul 7, 2013
    Posts:
    61
    Well, I *HAVE* tested it on a brand new project and on a project that I pulled down from the Unity Cloud.... a Published Android game. Is it possible to fix this? I followed the remove and reinstall process and I still get the error.
    If I remove "Stores.dll" it causes more errors. (Sorry if my tone is off, this is super frustrating.)
     
  5. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    6,534
    You didn't say the results of your testing on a brand new project, prior to loading any assets. Let's start there. Can you build a brand new project with a SampleScene? Please share the results and a screenshot of the Editor with the Console showing
     
  6. MichiealO

    MichiealO

    Joined:
    Jul 7, 2013
    Posts:
    61
    So far, the IAP Installer dialog box pops ups, and then breaks. I tried reimporting the stores.dll and it pulls up the IAP installer Dialog box. Give me a few minutes, and I will make a new blank project with the IAP in it. And, I'll put up a screenshot.
     
  7. MichiealO

    MichiealO

    Joined:
    Jul 7, 2013
    Posts:
    61
    new project, went into the services tab, clicked the flipswitch to enable it, and and it popped up with the IAP installer. I said "Install Now". Then this popped up.

    upload_2018-8-20_18-46-35.png
     
  8. MichiealO

    MichiealO

    Joined:
    Jul 7, 2013
    Posts:
    61
    I click ok, and then click Import on the right, in the services window. It asks again if i want to Install Now, I click "Install Now" And ... it goes through the import package routine.
    It's now asking me if I want to upgrade the project.

    upload_2018-8-20_18-50-47.png
     
  9. MichiealO

    MichiealO

    Joined:
    Jul 7, 2013
    Posts:
    61
    I told it to go ahead, and now it's not wanting to go boom on the stores.dll.
     
  10. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    6,534
  11. MichiealO

    MichiealO

    Joined:
    Jul 7, 2013
    Posts:
    61
    okay should I delete this project and do it over again, building it first?
    And, should I set it to be an Android project, like where I am having the issue?

    (And, on the old project that I pulled down from Collab, I deleted the two directories, clicked import and still had issues...)
     
  12. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    6,534
    I would recommend that you follow my directions, Build and Run to Android with the (empty) SampleScene with no assets loaded (to assure the basics are working first)
     
  13. MichiealO

    MichiealO

    Joined:
    Jul 7, 2013
    Posts:
    61
    That was just a confirmation question.

    Note: new project, switched to Android. Building. Nothing in the project except for the blank scene.

    upload_2018-8-20_19-10-31.png
     
  14. MichiealO

    MichiealO

    Joined:
    Jul 7, 2013
    Posts:
    61
    Interesting. There's the Aapt.exe Win32Exception error again. (that right there is why I pulled the last published version of my android game down from the cloud. Anyway.)


    upload_2018-8-20_19-15-10.png
     
  15. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    6,534
    I suspected you might have an error (which by the way is unrelated to IAP, you have a wider issue). So you've never been able to build to Android on this system?
     
  16. MichiealO

    MichiealO

    Joined:
    Jul 7, 2013
    Posts:
    61
    It worked fine until I switched to 2018.... and updated the sdk via 2018 by changing it from Nougat (API Level 25) to Oreo (API Level 27), and it helpfully installed the new sdk API level for me.
     
  17. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    6,534
  18. MichiealO

    MichiealO

    Joined:
    Jul 7, 2013
    Posts:
    61
    Thank you. Very helpful. Unfortunately, the issue that I am having (Because, I can fix the android compile issue myself) Is still with the Unity IAP and the fact that in my working game, Stores.dll. is being unloaded because it's "Known to break games during runtime"
     
  19. MichiealO

    MichiealO

    Joined:
    Jul 7, 2013
    Posts:
    61
    So... Can we please fix that?
     
  20. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    6,534
    That is exactly what we are working on. Get the compiler issue working first, then we'll get IAP working. First things first!
     
  21. MichiealO

    MichiealO

    Joined:
    Jul 7, 2013
    Posts:
    61
    Understand that. I'm fixing that now. Like I said... be a few. :D
     
  22. MichiealO

    MichiealO

    Joined:
    Jul 7, 2013
    Posts:
    61
    There. Built.

    upload_2018-8-20_21-46-48.png
     
  23. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    6,534
    Great! Continue with the process on this same app
     
  24. MichiealO

    MichiealO

    Joined:
    Jul 7, 2013
    Posts:
    61
    I did. I added in IAP last night. My question here is where do I take it, to get it to work in my actual app where the error is consistently generated, and I keep getting an Invalid state error when I try to replicate this, there. So, I would like the next step of this process so I can see where it actually fails and where it happily succeeds. (And, the request for direction here, is not due to inability but more of I don't know where it breaks and I would like the help in debugging the insanity.) Besides, I'm sure that others would like to know how to fix it, if they encounter it in the future. I've actually found years old articles that have helped me, in the recent past so...
     

    Attached Files:

  25. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    6,534
    You now have an app that works, and one that doesn't. At this point, this would be up to you,using basic troubleshooting, to determine the differences between the two. Please keep me posted on your progress. If you can provide definite steps to reproduce on a new project, I would likely be able to quickly resolve your issue. If you continue to have issues, I would recommend that you open a bug, and attach a minimal project that reproduces the issue along with specific steps for someone else to reproduce https://unity3d.com/unity/qa/bug-reporting
     
    Last edited: Aug 22, 2018
  26. MichiealO

    MichiealO

    Joined:
    Jul 7, 2013
    Posts:
    61
    So, I deleted the google play services resolver, Google AdMob package, and all traces if of the IAP stuff in the old project (A working release that I committed to Unity Cloud)... I deleted most of the Library Directory too.
    I copied the assets folder (with the working IAP stuff installed) over the old project and it worked. I had to Reimport All, and I had to use the Receipt Obfuscator to get past the Google Tangle and Apple Tangle Errors. But, I got it to run.

    Then, after looking up Unity UDP I removed the UDPSupport folder in the Plugins folder, and it broke. I'm guessing that it's UDP as in the network protocol, and not UDP as in the Unity Developer Program?

    I tried to reinstall the IAP to put the folder back, and apparently that's how you get the Stores.dll error that the op and my original comment referenced.
    Error message that popped up:
    Unloading broken assembly Assets/Plugins/UnityPurchasing/Bin/Stores.dll, this assembly can cause crashes in the runtime
    0x00000001415369B8 (Unity) StackWalker::GetCurrentCallstack
    0x000000014153CEF6 (Unity) StackWalker::ShowCallstack
    0x000000014140BA5B (Unity) GetStacktrace
    0x00000001408AE8F0 (Unity) DebugStringToFile
    0x0000000140BD981B (Unity) MonoManager::SetupLoadedEditorAssemblies
    0x0000000140BCE39C (Unity) MonoManager::EndReloadAssembly
    0x0000000140BD874D (Unity) MonoManager::ReloadAssembly
    0x0000000140E71D93 (Unity) ReloadAllUsedAssemblies
    0x0000000140E6C371 (Unity) HandleCompileStatus
    0x0000000140E6847A (Unity) CompileScriptsWait
    0x0000000140E67BC1 (Unity) CompileDirtyScriptsForEditorSyncInternal
    0x0000000140E67A2D (Unity) CompileDirtyScriptsForEditorSync
    0x0000000140E6943D (Unity) ForceRecompileAllScriptsAndDlls
    0x0000000140E72906 (Unity) ScriptCompilationPipelinePostProcessAssets
    0x0000000141FB214F (Unity) Postprocess
    0x0000000141FD4444 (Unity) AssetInterface::ApplyDefaultPostprocess
    0x0000000141FE4BDC (Unity) AssetInterface:: ProcessAssetsImplementation
    0x0000000141FEE73A (Unity) AssetInterface::StopAssetEditing
    0x0000000141FE9E23 (Unity) AssetInterface::Refresh
    0x0000000141F9F3F0 (Unity) AssetDatabase::Refresh
    0x00000001413CB43C (Unity) ImportPackageAssets
    0x00000001413D0BA2 (Unity) TickPackageImport
    0x0000000141448F21 (Unity) Application::TickTimer
    0x00000001415E8135 (Unity) MainMessageLoop
    0x00000001415EA51C (Unity) WinMain
    0x000000014242D8FA (Unity) __scrt_common_main_seh
    0x00007FFE45293034 (KERNEL32) BaseThreadInitThunk
    0x00007FFE45441431 (ntdll) RtlUserThreadStart

    Followed by:
    ReflectionTypeLoadException: Exception of type 'System.Reflection.ReflectionTypeLoadException' was thrown.
    System.Reflection.Assembly.GetTypes () (at <f826c2584fc94ec19a48a6576640bdc5>:0)
    UnityEditor.Purchasing.UnityIAPInstaller.<GetPurchasing>m__0 (System.Reflection.Assembly assembly) (at Assets/Plugins/UnityPurchasing/Editor/UnityIAPInstaller.cs:102)
    System.Linq.Enumerable+<SelectManyIterator>d__167`3[TSource,TCollection,TResult].MoveNext () (at <839a3cb835c04d14aeb58d83bb7bc4bd>:0)
    System.Linq.Enumerable+WhereSelectEnumerableIterator`2[TSource,TResult].MoveNext () (at <839a3cb835c04d14aeb58d83bb7bc4bd>:0)
    System.Linq.Enumerable.TryGetFirst[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Boolean& found) (at <839a3cb835c04d14aeb58d83bb7bc4bd>:0)
    System.Linq.Enumerable.FirstOrDefault[TSource] (System.Collections.Generic.IEnumerable`1[T] source) (at <839a3cb835c04d14aeb58d83bb7bc4bd>:0)
    UnityEditor.Purchasing.UnityIAPInstaller.GetPurchasing () (at Assets/Plugins/UnityPurchasing/Editor/UnityIAPInstaller.cs:104)
    UnityEditor.Purchasing.UnityIAPInstaller.EnablePurchasingService () (at Assets/Plugins/UnityPurchasing/Editor/UnityIAPInstaller.cs:481)
    UnityEditor.Purchasing.UnityIAPInstaller.Install () (at Assets/Plugins/UnityPurchasing/Editor/UnityIAPInstaller.cs:329)
    ReflectionTypeLoadException: Exception of type 'System.Reflection.ReflectionTypeLoadException' was thrown.
    System.Reflection.Assembly.GetTypes () (at <f826c2584fc94ec19a48a6576640bdc5>:0)
    UnityEditor.Purchasing.UnityIAPInstaller.<GetPurchasing>m__0 (System.Reflection.Assembly assembly) (at Assets/Plugins/UnityPurchasing/Editor/UnityIAPInstaller.cs:102)
    System.Linq.Enumerable+<SelectManyIterator>d__167`3[TSource,TCollection,TResult].MoveNext () (at <839a3cb835c04d14aeb58d83bb7bc4bd>:0)
    System.Linq.Enumerable+WhereSelectEnumerableIterator`2[TSource,TResult].MoveNext () (at <839a3cb835c04d14aeb58d83bb7bc4bd>:0)
    System.Linq.Enumerable.TryGetFirst[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Boolean& found) (at <839a3cb835c04d14aeb58d83bb7bc4bd>:0)
    System.Linq.Enumerable.FirstOrDefault[TSource] (System.Collections.Generic.IEnumerable`1[T] source) (at <839a3cb835c04d14aeb58d83bb7bc4bd>:0)
    UnityEditor.Purchasing.UnityIAPInstaller.GetPurchasing () (at Assets/Plugins/UnityPurchasing/Editor/UnityIAPInstaller.cs:104)
    UnityEditor.Purchasing.UnityIAPInstaller.EnablePurchasingService () (at Assets/Plugins/UnityPurchasing/Editor/UnityIAPInstaller.cs:481)
    UnityEditor.Purchasing.UnityIAPInstaller.Install () (at Assets/Plugins/UnityPurchasing/Editor/UnityIAPInstaller.cs:329)
     
  27. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    6,534
    MichiealO likes this.
  28. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    6,534
    MichiealO likes this.
  29. MichiealO

    MichiealO

    Joined:
    Jul 7, 2013
    Posts:
    61
    Ahh! OK!! that makes a lot of sense. My IAP Integration code, when I remove the IAP Plugin errors (because the plug in is missing) and I was wondering why the IAP Install would break. Now I know. So, After 2018.2.4f installs, I'll comment that out (I might just #ifdef it, in case I need to do it again) and reinstall the prev version of IAP.
    Thank you for the links, especially to the 1.20 IAP package, I'll download that now.
     
unityunity