OperationCanceledException: Read was canceled on underlying PipeReader - protocol-buffers

am getting this type of error while moving to NET 6.0
Grpc.Core.RpcException : Status(StatusCode="Unknown", Detail="Exception was thrown by handler. OperationCanceledException: Read was canceled on underlying PipeReader.")
package: Google.Protobuf v (3.21.12)
NET 6.0
I tried different solution while downgrading the version of the package
but still facing the same issue

Message SOMETHING doesn't provide the generated method that enables WriteContext-based serialization. You might need to regenerate the generated protobuf code.
This comes from here
The problem here is that you're using (significantly) older generated code which does not support the pipe APIs; you should regenerate the code from the .proto, after updating protoc or Grpc.Tools or whatever mechanism you've used to turn the .proto schema into C#. This must include any nested message types; the SOMETHING in the above message tells you about any that are still needed.

Related

Visual Studio 2019 - Connected Service Reference - OpenAPI is generating duplicate types

I am trying to generate an OpenApi service reference in Visual Studio 2019. .Net 5.0.
Right clicking project >Add>Connected Services>+ Service References
I am using NetDocs api "https://api.vault.netvoyage.com/v2/swagger/docs/v2".
Result: I get generated c# client code but it is duplicating the types with the errors below.
Severity Code Description Project File Line Suppression State
Error CS0102 The type 'v2Client' already contains a definition for '_settings' OpenAPITest C:\Users\dryfus\source\repos\OpenAPITest\obj\v2Client.cs 4941 Active
Error CS0579 Duplicate 'System.CodeDom.Compiler.GeneratedCode' attribute OpenAPITest C:\Users\dryfus\source\repos\OpenAPITest\obj\v2Client.cs 4936 Active
Error CS0102 The type 'v2Client' already contains a definition for '_baseUrl' OpenAPITest C:\Users\dryfus\source\repos\OpenAPITest\obj\v2Client.cs 4939 Active
Error CS0102 The type 'v2Client' already contains a definition for '_httpClient' OpenAPITest C:\Users\dryfus\source\repos\OpenAPITest\obj\v2Client.cs 4940 Active
Is there a way I can get this to work with the connector way without the duplicates? Or even cli? Any suggestions on why it is creating the duplicates?
I had the same issue, it turns out the code generation didn't like enpoints with an underscore in its operationId. Lucky for me, the service I was consuming was also part of our code, so I could just go to the Swagger configuration in the API side and change the CustomOperationIds setting.
I downloaded and use NSwagStudio to generate the client code and did not have the same issue that the Visual Studio connector had when generating the code.
https://github.com/RicoSuter/NSwag/wiki/NSwagStudio
It is actually caused by this option
OperationGenerationMode:MultipleClientsFromOperationId
MultipleClientsFromOperationId : Multiple clients from the Swagger operation ID in the form '{controller}_{action}'
However, if your classname is set as a static name, it will cause an error like you have.
The correct solution should be change the classname to something like
ClassName="{controller}ServiceClient"
So it will generate different classes.

Globalize.js with MVC - missing locale

I'm trying to get the Globalize.js library to work under an ASP.NET MVC 5 application + unobstrusive validation. Specifically, I have most of the libraries and requirements working as per the post https://stackoverflow.com/a/25289555/1838819. However, when validation actually kicks in on an input tag of type="text" but contains a decimal number, I get the following error;
Uncaught Error: E_MISSING_BUNDLE: {"locale":"en"}
at createError (cldr.js:339)
at validate (cldr.js:355)
at Cldr.main (cldr.js:669)
at numberNumberingSystem (number.js:450)
at numberPattern (number.js:1325)
at Function.Globalize.numberParser.Globalize.numberParser (number.js:1429)
at Function.Globalize.parseNumber.Globalize.parseNumber (number.js:1474)
at a.validator.methods.number (jquery.validate.globalize.min.js:1)
at a.validator.check (jquery.validate.min.js:4)
at a.validator.checkForm (jquery.validate.min.js:4)
I'm loading and configuring the library via;
$.when($.get("/Scripts/cldr/supplemental/likelySubtags.json"))
.done(function(result) {
Globalize.load(result);
Globalize.locale("en");
});
Which works and runs through fine until validation is attempted via;
$.validator.unobtrusive.parse(_form);
_form.validate();
if (_form.valid()) { // ** error thrown here
_uiModalConfirmForm.modal('toggle');
}
I'm nearly sure that I'm missing a load reference to locale/en.json or something very similar but finding that resource is seemingly next to impossible. The documentation for cldr (what Globalize currently uses as it's main source of localized data), is...self referential at best and quite frustrating to navigate. There are no specific NuGet packages for this either that I can find.
The documentation that I can find says that the resource should be compiled. Looking at the documentation for that compiler links back to the Gloablize documentation and further goes on about spinning up a test server, installing Node Package Manger or Bower and installing from there. Which...seems like overkill when all I want is a file. I haven't yet gone down this road as I'm hoping there's an easier, quicker method to locate the needed file.
Any help on actually configuring the resources for this library in Visual studio would be greatly appreciated.
CLDR-core: https://github.com/unicode-cldr/cldr-core
Globalize doc: https://github.com/globalizejs/globalize/blob/master/README.md
likelySubtags.json (weirdly difficult to find): https://github.com/unicode-cldr/cldr-core/blob/master/supplemental/likelySubtags.json

SwiftAutomation custom record compiler error

I'm using the SwiftAutomation framework to drive a scriptable app that searches for lyrics and returns a AS record. Everything was working correctly, until...
I mapped the AppleScript record to a custom Swift structure according to the SwiftAutomation documentation. The code in the xxxGlue.swift file looks correct, but the compiler complains about SwiftAutomation.SelfUnpacking, with several follow-on errors, when building the MacOSGlues framework.
public struct LFBLyricsInfoRecord: SwiftAutomation.SelfPacking, SwiftAutomation.SelfUnpacking { ... }
--> .../MacOSGlues/LyricsFBAGlue.swift:700:81: No type named 'SelfUnpacking' in module 'SwiftAutomation'
The SelfPacking public protocol is defined in SwiftAutomation, and SelfUnpacking protocol is defined right under it, but without the public keyword. Is that the cause of the compiler error, and if so, how do I fix it?
OK, I finally found a resolution. Seems you have to use different options for the aeglue utility when generating the glue file for the MacOSGlues framework and for the swift file where you actually use your automation, such as in the test project. In my case, where my scriptable app is named LyricsFBA.app, these were:
aeglue -S LyricsFBA.app
for MacOSGlues (generates a LyricsFBAGlue.swift that references SwiftAutomation, but does not include the custom record structure definition), and
aeglue -D -s 'LyricsInfo:lyricsInfo=score:Int+title:String+artist:String+composer:String+link:String+lyrics:String' LyricsFBA.app
for the test program (generatea a LyricsFBAGlue.swift that does not reference SwiftAutomation, but does include the custom record structure definition).

De-serialization without protobu

Using protobuf I am able to serialize data. I need to send this serialzed packet to different location. As I know I need protobuf again to de-serialize the data.
Is there a way in which we can de-serialize data without using full protobuf library or maybe a minimum version of protobuf.
TIA...
Once you have generated the serialization and deserialization code you don't need the protoBuff library. The ParseFromIstream() method is all you need.
From what I've read you never actually import Protobuf, you just run it to generate code that is dropped into the project. The generated code does not require the program that generated it.

reactive extension for f#

I am trying to call the rx 2.0 frameworok from fsharp.
I saw there is a project FSharp.Reactive which tries to map rx2.0 to FSharp.
Something very strange happens when I try to use it:
There is an error shown in the IDE, which can be reproduced in the following code:
module FSharp.Reactive2
open System
open System.Reactive
open System.Reactive.Linq
open System.Reactive.Concurrency
type IObservable<'a> with
// Subscribes to the Observable with just a next-function.
member this.Subscribe(onNext:'a -> unit) =
let toto = (Action<_> onNext)
this.Subscribe(toto)
internal error : the list had different lengths. Parameter name xs2
But when I compile it, it produces a dll, and the error goes away. If I modify the code file again, the error reappears.
This happens in other projects using the System.Reactive dll.
Am I doing something wrong // is there anything to deal with it // is that a bug ?
Internal errors indicate compiler bugs. Try sending an email to fsbugs#microsoft.com.

Resources