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. The 2023.1 beta is now available for testing. To find out what's new, have a look at our 2023.1 feature highlights.
    Dismiss Notice

WCF UseSynchronizationContext not working

Discussion in '2017.3 Beta' started by vs-cby, Nov 22, 2017.

  1. vs-cby


    Jun 23, 2017

    We are running a selfhosted WCF service in the Unity process.
    With the UnitySynchronizationContext fixed in 2017.3, I was hoping that the UseSynchronizationContext parameter for a WCF ServiceBehavior would work as well. This determines whether the WCF operations within the service run on the main thread or not.
    Unfortunately they never run on the main thread, regardless of the value of UseSynchronizationContext.
    Is this is a Unity or Mono issue?

    Code (CSharp):
    1. [ServiceBehavior(
    2.         InstanceContextMode = InstanceContextMode.Single,
    3.         ConcurrencyMode = ConcurrencyMode.Single,
    4.         IncludeExceptionDetailInFaults = true,
    5.         UseSynchronizationContext = true)]
    6. public class UnityWcfService
    7. { ...
    Thanks a lot.
  2. mkderoy


    Unity Technologies

    Oct 25, 2016
    Sounds like it might be a bug. Do you have a small code sample that exhibits the problem? If you file a bug through the bug reporter we'd be happy to take a look at this.
  3. Peter77


    QA Jesus

    Jun 12, 2013
    Since it's your 3rd post in this forum, I'm going to provide a more detailed answer how one can report a bug and why one should consider doing that over using the forum only.

    If you found a bug in Unity, it's recommended to submit a bug-report following the advice given in this document.

    Using the bug-reporter seems to be an important step, because it makes sure the report is in Unity Technologies bug-tracking pipeline, has to be processed at some point and you can kind of track if it's fixed. Using the forum is often used to add to a little more attention to a bug-report, but does not replace submitting the bug-report.

    It's from advantage to attach a project to the bug-report that UT can use to reproduce the issue and test their fix against. Providing a project to reproduce the issue is even more important if it's a crash bug. The easier an issue can be reproduced by QA, the more likely it is to get forwarded to a developer, who might or might not work on a bug-fix for that at some point.

    After you submitted the bug-report, you receive a confirmation email with a Case number. UT often asks us to post the Case number in the forum thread, which allows them to find that bug-report if they look at your post.

    Following these steps will increase the chance that UT is looking at your issue tremendously.
    mkderoy and charlesb_rm like this.