Questions tagged [marshalling]
Marshalling is the process of transforming the memory representation of an object to a data format suitable for storage or transmission
3,741
questions
0
votes
0
answers
40
views
Deserialize byte array in golang which was marshalled using python `marshal` library
I want to deserialize a byte array into an object in golang. The serialization was done in Python code using the "marshal" library
import marshal
mpayload = marshal.dumps((key, payload, str(...
-1
votes
0
answers
14
views
Use a class passed by reference when the unmanaged function demands two levels of indirection. Marshalling C++ Stucts in C# [closed]
In C++ code :
int32_t moduleGetInfo(moduleHandle hnd,
void** info); // info Pointer to a structure with additional
// information
enum InfoFlags { ...
0
votes
0
answers
22
views
C# Marshal Slice with stride
Is there a way to have a Span of 256 bytes divided as 8 elements (stride = 32bytes)? T is equal to 20 bytes so 12 bytes will be ignore.
By doing new Span(ptr, 64) the stride is equal to 4, because a ...
-2
votes
0
answers
19
views
Caused by: java.io.IOException: Async IO operation failed (1), reason: RC: 32 There is no process to read data written to a pipe [closed]
In spring application using SOAP service trying to retrieve a large data and end up getting
Caused by: java.io.IOException: Async IO operation failed (1), reason: RC: 32 There is no process to read ...
0
votes
1
answer
23
views
go-toml Marshal fails
the following program tries to Marshal a struct and write to file.
The struct is nested and it contains toml tags.
I am not receiving any error message and it seems correct.
The print of the structure ...
0
votes
0
answers
53
views
Actual address of COM object in C#
I have a COM object for which I am trying to get the actual underlying address of, so I can get the address of the vtable. I need this to be a valid numerical address because I need to be able to add ...
0
votes
1
answer
28
views
Jaxb marshalling with nillable = true on collection do not work
I've got DTO:
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class MyData {
private String payload;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@...
0
votes
1
answer
26
views
SOAP client configuration No marshaller registered
I'm trying to consume a SOAP service with spring boot and kotlin. But my application doesn´t recognize a marshaller within the service(client).
The project compiles and runs, but when I make the ...
0
votes
1
answer
91
views
Marshal structure to pointer - Byte is OK, Byte() is Not OK
I am trying to get a pointer from a Structure, to pass it over to an unmanaged DLL.
The weird thing is the following, if I use this Structure:
Structure message
Public x As Byte
End Structure
And ...
0
votes
0
answers
54
views
Delphi JCL and passes the Marshall object through the interface, it raise an exception in Delphi, it is rethrown correctly in C# - HRESULT: 0x8000FFFF
I want to catch exception thrown in Delphi witch pass to C# library as interface using JCL.
The exception is caught but there is 0x8000FFFF.
What do I do wrong?
Delphi code:
unit TestClass;
interface
...
1
vote
1
answer
35
views
Prevent the CLR from freeing memory of a marshalled double char pointer?
I am building a Visual Studio 2022 extension in C# and am currently playing around with the VS API. I am trying to call IVsObjectList2.GetText(), which is a COM interface. However, VS is crashing ...
0
votes
1
answer
38
views
Unable to generate XML using JAXB marshaller for nested Objects from different packages
**XSD1**
<xs:complexType name="Root1">
<xs:sequence>
<xs:element name="Revision" type="xs:string" />
<xs:element ...
1
vote
1
answer
52
views
How to Marshal data in a double-nested structure
The following code has been simplified, but embodies the general functionality. It currently works with just Struct1 and Struct2, but I need to add the third structure. The issue is that the size of ...
2
votes
1
answer
54
views
How to Go asn1 marshal/unmarshal and omit fields?
type bearer struct {
CreatedAt time.Time `asn1:"generalized"`
ExpiresAt time.Time `asn1:"generalized"`
Nonce string
Signature []byte `asn1:"-...
0
votes
0
answers
30
views
Dynamic root element marshaling failed in XSD
I have below XML ,
<?xml version="1.0" encoding="UTF-8" ?>
<META_1>
<row num="1"><symbol>ABC</symbol></row>
<row num="2"&...
0
votes
0
answers
28
views
Using Marshal to send a JAXB object with the XML having no whitespaces (marshalSendAndReceive)
I am trying to use marshalSendAndReceive in order to convert my JaxB object to XML and send a request to an endpoint. However, the issue is I have quite a large XML which is causing failures in some ...
0
votes
1
answer
81
views
How to json marshal without omitempty on struct fields
I have a generated type A,
I want to json.Marshal the type and to ignore any empty fields while testing.
The generated type comes without json:",omitempty" for any struct fields, nor would I ...
-1
votes
1
answer
74
views
What are the performance costs/considerations when pinning memory in c#/.net
Context:
I have a c# opengl desktop app.
We have various buffers that get updated every frame, and so need to be transferred to the GPU every frame.
Currently we are holding a single pin to each ...
2
votes
1
answer
69
views
Overlapping or wrongly aligned struct
I have an issue with my struct layout. I want to have a struct with an array of other structs. The compiler does not complain with my implementation:
[StructLayout(LayoutKind.Explicit, Pack = 1, Size =...
0
votes
0
answers
92
views
Marshal struct and pointer in struct from c# to c++
I have the following structures in C# and C++.
C++:
typedef struct _st_a {
double dLon;
double dLat;
double dE;
double dN;
double dU;
} ST_A;
typedef struct _st_b {
unsigned ...
0
votes
1
answer
69
views
Question about the implementation of "Marshal.GetActiveObject(System.String)" method
I'm trying to connect to a running Solid Edge instance, but I am getting the following error:
System.MissingMethodException: 'Method not found: 'System.Object System.Runtime.InteropServices.Marshal....
1
vote
0
answers
264
views
Spring Boot 3 support for application/xml content in http calls
After migrating from Spring Boot 2.7.0 to version > 3 Spring application looses support for accepting application/xml content. It now throws the exception below. I also build new demo apps in ...
0
votes
2
answers
143
views
Custom converter for TJsonMarshal in Delphi 11
I am trying to register a custom converter to avoid the inherited properties in TObjectList - mainly FListHelper and FOwnsObjects. But I cannot get the custom converter to register, and the ...
2
votes
1
answer
118
views
How to avoid parsing of json object in ISuperObject-typed field
Long time ago we decided to use XSuperObject library for marshalling objects into json for transition between two parts of system. One of fields represents as ISuperObject on server side and as ...
0
votes
1
answer
54
views
Python struct.unpack format from header .h file
I have a header (.h) file describing some datastructures (the data is collected from a sensor). Example:
...
struct SensorIf
{
DWORD SensorType;
char Name[...
-1
votes
1
answer
66
views
How to re-use a struct from an third-party package, while changing the marshalling behavior for a single field?
Let's say I want to marshal a struct into YAML, and the struct already has all of its YAML tags defined, except there is one tag that I want to change. How can I change the behavior for this single ...
3
votes
1
answer
449
views
Using CryptUI Library to Sign Byte Array in C#
I was able to succesfully use the information on this page to digitally sign a file using an x509 certificate (.pfx file) using the following code:
const Int32 CRYPTUI_WIZ_NO_UI = 1;
const ...
0
votes
0
answers
59
views
Method not returning same result as a block of code in main. Identical code
I am making a console application that sends and returns data in c# to a dll(c++), and returns it.
I made it work but run into a problem I cant understand.
When I call a block of code in the main ...
0
votes
1
answer
47
views
Marshal C++ union in C# that contains a pointer to an array
I have a problem creating a structure layout in C# that corresponds to the one in C++ so it can be marshaled. Here's the types that should be marshaled in C++:
enum E1
{
};
enum E2
{
};
struct Foo
{
...
0
votes
1
answer
34
views
Chained Marshal OffsetOf for Nested Struct
Have the same confusion as commented in this answer.
Quotes from CleanCoder:
Can Marshal.OffsetIf be used for fields/props in structs of structs? How this needs to be named? lets say for: Struct1....
0
votes
1
answer
48
views
How can I move the namespace definition from the root element to a specific child in JAXB?
I am developing a Java application that marshals Java objects into XMLs using JAXB. Currently, the generated XML looks like the following one:
<A xmlns="A" xmlns:ns2="B" xmlns:...
1
vote
1
answer
49
views
How to get the string from an unmanaged void* parameter?
[DllImport("SiUSBXp.dll", CharSet = CharSet.Auto, EntryPoint =
"SI_GetProductStringSafe")]
static extern SI_STATUS GetProductString(
int dwDeviceNum,
...
1
vote
0
answers
52
views
Bug in Golang xml/encoding RawToken()?
I have a Go code:
xmlData := `<foo xmlns:="url"/>`
xmlDec := xml.NewDecoder(bytes.NewReader([]byte(xmlData)))
rawToken, _ := xmlDec.RawToken()
fmt.Println(rawToken)
Now interesting ...
1
vote
0
answers
85
views
The problem with escaping characters in Golang
There is the following program:
package main
import (
"encoding/xml"
"fmt"
)
type XMLData struct {
XMLName xml.Name `xml:"tags"`
Tags []Tag `xml:&...
2
votes
0
answers
42
views
dll not modifying input parameters
I'm working on a C# application that requires some data processing to be done in a dll. Im in the process of setting up the dll and making sure that I can pass values back and forth before dropping in ...
0
votes
0
answers
50
views
How to pass / marshal a struct with a string[] field from C# to C++ library with C bindings?
I would like to pass a configuration structure from C# to a library with a C interface (that has a C++ implementation behind the interface).
Below are the .h/.cpp files and the C# code calling into it ...
0
votes
1
answer
44
views
Marshalling variable-sized string C array into C# (Unity iOS)
I need to return a collection of strings from Objective-C to C# and can't wrap my head around how to do this properly. When I print the returned pointer on managed side its value is 0.
Objective-c
...
0
votes
0
answers
40
views
Namespace prefix is changed after adding one element to xsd
I have a xsd as below
............
<xs:complexType name="PAccount1">
<xs:sequence>
<xs:element name="RegnId" type="p1:Max35Text" minOccurs="...
-1
votes
2
answers
114
views
How to marshal this c struct and call its method in c#
I've seen answers similar to this in other places, but none of those solutions are working and usually they are slightly different questions. I haven't seen any of the other questions' solutions help ...
-1
votes
1
answer
45
views
PInvoke: Struggle to set up struct with a buffer pointer which could take various types depending on context
I am trying to build C# client for IBM TSM Api (tivoli storage manager) represented by tsmapi64.dll
For reference I have api documentation and also a sample application (source code + headers), ...
1
vote
3
answers
119
views
Interop C# IntPtr to C void* to C++ PCCERT_CONTEXT and back again
I'm needing to use C++ to get a certificate from the local machine store because Unity & Mono don't support the local machine store correctly.
To that end I've implemented the following, but my ...
0
votes
0
answers
34
views
Could not unmarshal / marshal... Could not load class
We expose REST endpoints for GET and PUT requests. Example for PUT requests:
@PutMapping(value = "/{segment}",
produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}
...
0
votes
0
answers
47
views
JAXB marshalls only root when marshalling to node
I'm trying to marshal a new header to SOAP message, but JAXB only marshalls the root of the Java object. When I try to marshal it to System output the marshalling goes OK.
Note: namespaces are ...
0
votes
2
answers
74
views
How to Marshal a nested array of pointers in c#
Library uses nested array of pointer to struct, but result in an exception when using.
When there is no nested array of pointers to struct paramB, then there is no exception.
Original code for use of ...
0
votes
0
answers
91
views
Why Drools business-central throw marshalling exception during startup
I've got an error: "Failed to bootstrap errai marshalling system!" during Wildfly 24.0.1.Final deployment of Drools business-central.war file version 7.73.0-Final downloaded from official ...
0
votes
0
answers
529
views
Is Jaxb2Marshaller compatible with Spring boot 3+ and Jaxb 4?
I am upgrading my project from spring boot 2.7 -> spring boot 3.1. Still using SOAP in this project, so we are dependant on Jaxb & spring WS.
I am generating Java classes with com.helger.maven:...
0
votes
0
answers
326
views
JAXB Exception in Java Spring Boot SOAP client
I am trying to create a Java Spring Boot SOAP client.
I followed this instruction: https://www.baeldung.com/spring-soap-web-service
I am using Java 17 with Spring 3.1.0.
The basic steps are:
generate ...
0
votes
1
answer
475
views
Unable to load DLL "Module could not be found HRESULT: 0x8007007E"
I have C# WPF application in which I have used C++ DLL libraries. When I build my project it builds successfully and all my DLL and exe are stored in bin/(Platform) eg(bin/Debug) folder.
Now if I copy ...
0
votes
1
answer
73
views
How to skip null values in json text produced by gson, if TypeAdapter converts null-value?
I created a TypeAdapter for the Type Instant by writing milliseconds.
How can I handle the case of the instant-field to be null.
I do not want to write a kind of special entry like -1L, which I later ...
-1
votes
1
answer
191
views
Marshalling LPDWORD into C# for P/Invoke
I have a C++ function (WinAPI) with the following signature:
__declspec(dllimport) LPDWORD WINAPI MyFunction(HDET hDet, WORD wStartChan, WORD wNumChans,
LPDWORD lpdwBuffer, LPWORD lpwRetChans, ...