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
  3. Dismiss Notice

Bug SvcUtil.exe is not working in 2021 onwards

Discussion in 'Editor & General Support' started by StuartJMcc, Jun 29, 2023.

  1. StuartJMcc

    StuartJMcc

    Joined:
    Aug 12, 2020
    Posts:
    14
    Firstly let me point out I'm not primarily a Unity dev (I dabble) and I'm not sure if this post is in the right place so please bear with me.

    So, I have a WCF service which we have been using for a few years now which has both Unity and Windows apps consuming it. I generate the service contract file using the Unity versions svcutil.exe as you do.
    However, the last version of Unity we have been able to get this to work on is 2020.3.19f1.
    We have recently moved on to 2021.3.21.f1 then 2022.3.3f1 so I thought I'd better update the contract file and plugin dll's, but svcutil is throwing an exception for these environments. As the service is consumable by a windows app I'm assuming it is fine and there is no Unity code involved at this stage - this is just generating a file from a tool - so I am assuming it is the tool that is at fault.
    This is my command prompt output running svcutil from 3 different places:

    D:\GitSource_RidingSims\GEN2-Service\RacewoodServiceLibrary>"C:\Program Files\Unity\Hub\Editor\2021.3.21f1\Editor\Data\MonoBleedingEdge\lib\mono\4.5"\svcutil -out:RacewoodTelemetryService.cs http://localhost:9001/RacewoodServiceLibrary/?wsdl

    Unhandled Exception: System.MissingMethodException: Method not found: 'System.String[] System.String.Split(Char, System.StringSplitOptions)'.
    at Mono_Options.Option..ctor(String prototype, String description, Int32 maxValueCount, Boolean hidden)
    at Mono_Options.OptionSet.Add(String prototype, String description, Action`1 action, Boolean hidden)
    at Mono.ServiceContractTool.CommandLineOptions.CreateOptions()
    at Mono.ServiceContractTool.CommandLineOptions..ctor()
    at Mono.ServiceContractTool.Driver.Main(String[] args)

    D:\GitSource_RidingSims\GEN2-Service\RacewoodServiceLibrary>"C:\Program Files\Unity\Hub\Editor\2022.3.3f1\Editor\Data\MonoBleedingEdge\lib\mono\4.5"\svcutil -out:RacewoodTelemetryService.cs http://localhost:9001/RacewoodServiceLibrary/?wsdl

    Unhandled Exception: System.MissingMethodException: Method not found: 'System.String[] System.String.Split(Char, System.StringSplitOptions)'.
    at Mono_Options.Option..ctor(String prototype, String description, Int32 maxValueCount, Boolean hidden)
    at Mono_Options.OptionSet.Add(String prototype, String description, Action`1 action, Boolean hidden)
    at Mono.ServiceContractTool.CommandLineOptions.CreateOptions()
    at Mono.ServiceContractTool.CommandLineOptions..ctor()
    at Mono.ServiceContractTool.Driver.Main(String[] args)

    D:\GitSource_RidingSims\GEN2-Service\RacewoodServiceLibrary>"C:\Program Files\Unity\Hub\Editor\2020.3.19f1\Editor\Data\MonoBleedingEdge\lib\mono\4.5"\svcutil -out:RacewoodTelemetryService.cs http://localhost:9001/RacewoodServiceLibrary/?wsdl
    Mono service contract conversion tool 0.1.0.0 - Copyright (C) 2006 Novell, Inc.

    Attempting to download metadata from 'http://localhost:9001/RacewoodServiceLibrary/?wsdl' using DISCO..
    Disco found documents at the following URLs:
    - Xml Schema at http://localhost:9001/RacewoodServiceLibrary/?xsd=xsd1
    - Xml Schema at http://localhost:9001/RacewoodServiceLibrary/?xsd=xsd2
    - WSDL document at http://localhost:9001/RacewoodServiceLibrary/?wsdl=wsdl0
    - Xml Schema at http://localhost:9001/RacewoodServiceLibrary/?xsd=xsd0
    - WSDL document at http://localhost:9001/RacewoodServiceLibrary/?wsdl
    Generating files..
    RacewoodTelemetryService.cs

    D:\GitSource_RidingSims\GEN2-Service\RacewoodServiceLibrary>

    So two questions:
    1/ What has changed with svcutil.exe and how do I fix it?
    and
    2/ Is there a problem using the 2020 contract file and DLL's with a 2022 Unity application?

    Any help would be appreciated.
    PS: I'm not even using the Split function anywhere!!
     
  2. KingdomHearts

    KingdomHearts

    Joined:
    Feb 25, 2019
    Posts:
    1
    Did you solve it by any chance? I have the same problem
     
  3. StuartJMcc

    StuartJMcc

    Joined:
    Aug 12, 2020
    Posts:
    14
    We did get a response from Unity on this, which I can't quote verbatim at the moment, but the basics of it are that apparently this facility was never meant for everyday users and it was more of an internal developer thing but they are still looking into it.

    In the mean time they suggested that the Microsoft SVCUtil be used instead. However, I still don't know which DLL's you need to drop into the plugins folder so I suppose you'd have to try both Microsoft and the Unity specific versions and see which work best. They also said there should not be problem using the contract file generated by the earlier version of SVCUtil, but again no elaboration on which DLL's to use.

    As you may have worked out from my comments above, we haven't actually tried this yet. It was a bit of a showstopper for us so we regressed back to 2020 until we had some bandwidth to solve the problem.

    I hope this helps and if you find out more about the DLL's to use please post back here and let me know - It'll save me some grief later on :)
     
  4. StuartJMcc

    StuartJMcc

    Joined:
    Aug 12, 2020
    Posts:
    14
  5. StuartJMcc

    StuartJMcc

    Joined:
    Aug 12, 2020
    Posts:
    14
    Don't know if it's just coincidence or not but the bug was closed last night.
    I'm somewhat concerned as they created this bug from my initial contact with them (which was my original post) but now they say they aren't going to fix what they identified as a problem with their own system.
    Further to this the resolution notes imply that their SVCUtil actually works when it clearly doesn't.
    the notes read "SVCUtil that is in the unity install is a managed executable that needs to be run with the mono version that is also part of the unity install....
    ....Launching svcutil.exe directly will use the .Net framework that is installed and is not comparable"

    I'm not sure what to make of that - I think the Resolver is describing what I was happily doing until it stopped working!!

    Has anyone out there had more experience of Unity issue handling? Is this normal?
     
  6. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    8,992
    does running it through mono.exe make any difference then?

    its pretty normal as they are trying to save costs, so issues get skipped..
     
  7. StuartJMcc

    StuartJMcc

    Joined:
    Aug 12, 2020
    Posts:
    14
    I'm beginning to think I'm missing something with regards to "running it through mono"!
    SVCUtil.exe is a command line tool I call from a command prompt (see original post). I don't know of any other way to run it.
    The issue resolver seems to be describing the original process but as the Unity bug handling system seems to have converted my original information to them (again original post above) into something more simplistic - I don't think they realise the .exe just doesn't work.
    Looks like a case of one dev looking at the problem says "yeah just take it out" and raises a bug to take it out and then another one looks at that request and says "you can't do that, it's needed" without seeing the original information.

    If there's another way to run this through mono.exe then somebody please let me know. In the mean time I've instructed my guy to place a comment on the bug stating that the exe doesn't work and if there's no response by Friday we'll raise another bug I think.
     
  8. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    8,992
    StuartJMcc likes this.
  9. StuartJMcc

    StuartJMcc

    Joined:
    Aug 12, 2020
    Posts:
    14
    Oh Dear, I think I've been staring at this too long - when I originally got this information from my dev it was displayed on two lines and I just didn't make the connection!! Doh! :confused:

    I'll give that a go when I get a chance - although it does make me wonder why everything was working fine the way I was doing it beforehand.
     
  10. StuartJMcc

    StuartJMcc

    Joined:
    Aug 12, 2020
    Posts:
    14
    @mgear - you're a genius!!!! Bit of faffing needed for the quotes but you were spot on....
    "C:\Program Files\Unity\Hub\Editor\2022.3.3f1\Editor\Data\MonoBleedingEdge\bin\mono.exe" "C:\Program Files\Unity\Hub\Editor\2022.3.3f1\Editor\Data\MonoBleedingEdge\lib\mono\4.5\svcutil.exe" -out:RacewoodTelemetryService.cs http://localhost:9001/RacewoodServiceLibrary/?wsdl

    @KingdomHearts: I hope this helps you with your problems too.