Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WCF Web Service Reference Provider Generates only Async Operations #2720

Closed
martinspasovski opened this issue Mar 27, 2018 · 3 comments
Closed
Assignees
Labels
tooling An issues related to any tool shipped from this repo.
Milestone

Comments

@martinspasovski
Copy link

When trying to add service reference of https://www.onvif.org/ver10/device/wsdl/devicemgmt.wsdl
I am getting only async methods generated

I am using VS 15.7.0 Preview 2.0

After adding the service reference i am getting this in the output of the generator

Importing web service metadata ...
Number of service endpoints found: 0
Scaffolding service reference code ...
Warning:Warning: There was a validation error on a schema generated during export:
Source:
Line: 2 Column: 3
Validation Error: The global attribute 'http://www.w3.org/XML/1998/namespace:lang' has already been declared.
Warning:Warning: There was a validation error on a schema generated during export:
Source:
Line: 3 Column: 3
Validation Error: The global attribute 'http://www.w3.org/XML/1998/namespace:space' has already been declared.
Warning:Warning: There was a validation error on a schema generated during export:
Source:
Line: 11 Column: 3
Validation Error: The global attribute 'http://www.w3.org/XML/1998/namespace:base' has already been declared.
Warning:Warning: There was a validation error on a schema generated during export:
Source:
Line: 12 Column: 3
Validation Error: The global attribute 'http://www.w3.org/XML/1998/namespace:id' has already been declared.
Warning:Warning: There was a validation error on a schema generated during export:
Source:
Line: 13 Column: 3
Validation Error: The attributeGroup 'http://www.w3.org/XML/1998/namespace:specialAttrs' has already been declared.
Warning:Warning: There was a validation error on a schema generated during export:
Source:
Line: 370 Column: 8
Validation Error: Wildcard '##targetNamespace' allows element 'http://www.onvif.org/ver10/schema:SceneOrientation', and causes the content model to become ambiguous. A content model must be formed such that during validation of an element information item sequence, the particle contained directly, indirectly or implicitly therein with which to attempt to validate each item in the sequence in turn can be uniquely determined without examining the content or attributes of that item, and without any information about the items in the remainder of the sequence.
Warning:Warning: There was a validation error on a schema generated during export:
Source:
Line: 430 Column: 8
Validation Error: Wildcard '##any' allows element 'http://www.onvif.org/ver10/schema:Transmittance', and causes the content model to become ambiguous. A content model must be formed such that during validation of an element information item sequence, the particle contained directly, indirectly or implicitly therein with which to attempt to validate each item in the sequence in turn can be uniquely determined without examining the content or attributes of that item, and without any information about the items in the remainder of the sequence.
Warning:Warning: There was a validation error on a schema generated during export:
Source:
Line: 518 Column: 8
Validation Error: Wildcard '##targetNamespace' allows element 'http://www.onvif.org/ver10/schema:SceneOrientationMode', and causes the content model to become ambiguous. A content model must be formed such that during validation of an element information item sequence, the particle contained directly, indirectly or implicitly therein with which to attempt to validate each item in the sequence in turn can be uniquely determined without examining the content or attributes of that item, and without any information about the items in the remainder of the sequence.
Warning:Warning: No endpoints compatible with .Net Core apps were found.
Generating files...
C:\Users\Administrator\AppData\Local\Temp\WCFConnectedService\2018_Mar_27_22_07_37\Reference.cs
Updating project ...
Done.

@martinspasovski martinspasovski changed the title WCF Web Service Reference Provider Generates only Async WCF Web Service Reference Provider Generates only Async Operations Mar 27, 2018
@Lxiamail Lxiamail added this to the S133 milestone Mar 29, 2018
@mlacouture
Copy link
Member

Hi @martinspasovski
Thank you for reporting this issue. This is a dup of issue #654

@mlacouture mlacouture added the tooling An issues related to any tool shipped from this repo. label Mar 29, 2018
@mlacouture mlacouture self-assigned this Mar 29, 2018
@puterprogrammer
Copy link

Until Sync versions of methods return, it is possible to use Async.
But here's an example of the transition from the Classic .Net to the new Core.Net

Classic .Net...
//invoke the login operation
SessionResponse s = ns.login(passport);
if (s.status.isSuccess)
{ . . .

Core.Net Translation...
//invoke the login operation
loginRequest loginReq = new loginRequest(appInfo, partnerInfo, passport);
loginResponse loginResp = nsClient.loginAsync(loginReq).Result;
SessionResponse s = loginResp.sessionResponse;

            if (s.status.isSuccess)
            { . . .

re: nsClient.loginAsync(loginReq).Result; << .Result simply waits for the Async result, Walla! -> sync.

Unequivocally,
~puter.programmer

@kendallb
Copy link

Ok this is ridiculous. You have to properly support non-async functions for those who are currently not in a fully async environment. As anyone who has done async programming should now, YOU CANNOT MIX ASYNC AND NON-ASYNC CODE! You can't just do this as the poster above suggested:

loginResponse loginResp = nsClient.loginAsync(loginReq).Result;

That will I guarantee you result in deadlocks if you are doing this in a threaded environment especially in web applications. And you can't just say 'go async all the way' as that is practically not always possible to do when you have a lot of legacy code.

So without a client that is correctly generating non-async functions, the only option you are left with is to wrap all your non-async functions in Task.Run() wrappers to run the async in another thread, and block and wait until it is done. It's the only way to avoid deadlocks.

So by not supporting this, you are guaranteeing that people will take the simple approach and do a task.Result as suggested above, and end up with head scratching deadlocks ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tooling An issues related to any tool shipped from this repo.
Projects
None yet
Development

No branches or pull requests

5 participants