Search Unity

  1. Calling all beginners! Join the FPS Beginners Mods Challenge until December 13.
    Dismiss Notice
  2. It's Cyber Week at the Asset Store!
    Dismiss Notice

HttpClient

Discussion in 'Experimental Scripting Previews' started by rakkarage, Mar 13, 2017.

  1. MaxXR

    MaxXR

    Joined:
    Jun 18, 2017
    Posts:
    67
    So I renamed it to csc.rcp and relaunched but still no change/same error :/

    Any ideas?

    upload_2018-9-13_0-53-19.png
     
  2. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    4,136
    I'm not sure then. Can you look in the Editor.log file for the C# compiler command line when this error happens? Please post that command line here.
     
  3. pavelkouril

    pavelkouril

    Joined:
    Jul 22, 2016
    Posts:
    125
    Yeah - well, we are limited by this, especially when the referenced assemblies are different for player and editor when using the .NET Standard. We had to copy the DLL from Unity's mono distribution to Editor/Plugins to overcome this limitation (or is there any other way?), but using the response file for only editor environment would be much better IMHO.
     
  4. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    4,136
    Thanks for the information. I don't think there is a better way to do this now.
     
  5. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    4,136
    I guess another option is to write a custom build that changes the contents of the response file if this is a player build. But that is not a great option if you don't already have a custom build.
     
  6. pavelkouril

    pavelkouril

    Joined:
    Jul 22, 2016
    Posts:
    125
    This is not about the player per se, or is it? IMHO it's about Assembly-CSharp referencing .NET Standard DLLs, and all the editor assemblies referencing the .NET Framework DLLs, meaning the Assembly-CSharp cannot reference some of the DLLs editor scripts can?

    Edit: nevermined, I used player/editor above myself, my bad then :)
     
  7. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    4,136
    Yes, you are correct. Even in the older .NET 3.5 equivalent scripting runtime, this is the case. For both scripting runtimes, we have "full" profile and a "subset" profile:
    • .NET 3.5 Equivalent scripting runtime
      • "full" profile: .NET 2.0
      • "subset" profile: .NET 2.0 Subset
    • .NET 4.x Equivalent scripting runtime
      • "full" profile: .NET 4.x
      • "subset" profile: .NET Standard 2.0
    Editor code (e.g. menus, editor extensions) always references the "full" profile, but player code references the profile set by the Api Compaibility Level option, which could be the "full" or the "subset" profile.
     
  8. MaxXR

    MaxXR

    Joined:
    Jun 18, 2017
    Posts:
    67
    Ok here you go - copied from last 2 Bio scripts to end of error:

    Code (CSharp):
    1. Assets\Scripts\Bio.Core\Web\Blast\NcbiBlastWebHandler.cs
    2. Assets\Scripts\Bio.Core\WordMatch.cs
    3. Assets\Scripts\Citations.cs
    4. Assets\Scripts\DrawLine.cs
    5. Assets\Scripts\Lessons\Clade.cs
    6. Assets\Scripts\Lessons\ExtensionMethods.cs
    7. Assets\Scripts\Lessons\Program.cs
    8. Assets\Scripts\Link.cs
    9. Assets\Scripts\MapData.cs
    10. Assets\Scripts\Node.cs
    11. Assets\Scripts\XMLGeneratedClasses.cs
    12. Assets\TestBio.cs
    13. Assets\WireArcExample.cs
    14.  
    15. -----CompilerOutput:-stdout--exitcode: 1--compilationhadfailure: True--outfile: Temp/Assembly-CSharp.dll
    16. Microsoft (R) Visual C# Compiler version 2.7.0.65535 (6e7d8658)
    17. Copyright (C) Microsoft Corporation. All rights reserved.
    18.  
    19. Assets\Scripts\Bio.Core\Web\Blast\NcbiBlastWebHandler.cs(159,16): error CS0246: The type or namespace name 'HttpContent' could not be found (are you missing a using directive or an assembly reference?)
    20. -----CompilerOutput:-stderr----------
    21. -----EndCompilerOutput---------------
    22. - Finished compile Library/ScriptAssemblies/Assembly-CSharp.dll
    23. - Finished compile Library/ScriptAssemblies/Assembly-CSharp-Editor-firstpass.dll
    24. Assets\Scripts\Bio.Core\Web\Blast\NcbiBlastWebHandler.cs(159,16): error CS0246: The type or namespace name 'HttpContent' could not be found (are you missing a using directive or an assembly reference?)
    25. (Filename: Assets\Scripts\Bio.Core\Web\Blast\NcbiBlastWebHandler.cs Line: 159)
    26.  
    27. Assets\Standard Assets\Editor\CrossPlatformInput\CrossPlatformInputInitialize.cs(95,17): warning CS0618: 'BuildTargetGroup.PSM' is obsolete: 'PSM has been removed in >= 5.3'
    28. (Filename: Assets\Standard Assets\Editor\CrossPlatformInput\CrossPlatformInputInitialize.cs Line: 95)
    Any idea what might be happening and potential solutions?
     
  9. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    4,136
    I thought the entire C# compiler command line should be in the Editor.log, but it seems it is not here. Can you attach the full Editor.log file here so that we can be sure it is not hiding elsewhere?
     
  10. MaxXR

    MaxXR

    Joined:
    Jun 18, 2017
    Posts:
    67
  11. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    4,136
    Thanks, this log does have the full compiler command line, which is great.

    It looks like the System.Net.Http.dll is not being passed to the compiler, so at least the error you see makes sense. But why is it not passed?

    Can you provide the contents of the csc.rsp file from your project? Also, where is that csc.rsp located in your project? Thanks!
     
  12. MaxXR

    MaxXR

    Joined:
    Jun 18, 2017
    Posts:
    67
    You bet. Contents of csc.rsp is "-r:System.Net.Http.dll" and its in the Assets folder.
    upload_2018-9-14_13-2-28.png
     
  13. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    4,136
    Thanks! One more sanity check: What are your values for the Scripting Runtime Version and Api Compatibility Level in the Player Settings?
     
  14. MaxXR

    MaxXR

    Joined:
    Jun 18, 2017
    Posts:
    67
    Scripting Runtime = .Net 4.x
    API Compatibility = .Net Standard 4.x

    Also tried .Net Standard 2.0 but same error.

    Are you able to get it working on your machine?
    Lib is https://www.nuget.org/packages/NetBio.Core/3.0.0-alpha

    Many thanks
    upload_2018-9-15_20-13-15.png
     
  15. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    4,136
    All indications are that this should work.

    Can you submit a bug report that includes this project where it does not work? That will ensure we are seeing the same setup you see, and we should be able to track down what is wrong.
     
  16. MaxXR

    MaxXR

    Joined:
    Jun 18, 2017
    Posts:
    67
    Yep, lodged a bug report. Title is:
    'HttpContent' not found - 2018.3 error with .BIO library import
     
  17. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    4,136
    Thanks, can you let me know the bug number as well?
     
  18. MaxXR

    MaxXR

    Joined:
    Jun 18, 2017
    Posts:
    67
    Yep, Case 1082595
    Many thanks
     
    JoshPeterson likes this.
  19. danrayson

    danrayson

    Joined:
    Mar 3, 2013
    Posts:
    10
    If anyone else comes across this issue - There's a workaround (and a VERY easy one at that) posted here: https://stackoverflow.com/a/46008025/1073157 It basically says "Use Unity's built-in UnityWebRequest class", therefor no dependency on System.Net.Http. For me, this was enough to connect to a WebAPI service.