https://bugs.documentfoundation.org/show_bug.cgi?id=166376
Bug ID: 166376
Summary: net_uno access viololation when applying filterdata
to pdf export
Product: LibreOffice
Version: 25.2.2.2 release
Hardware: All
OS: All
Status: UNCONFIRMED
Severity: normal
Priority: medium
Component: sdk
Assignee: [email protected]
Reporter: [email protected]
Created attachment 200577
--> https://bugs.documentfoundation.org/attachment.cgi?id=200577&action=edit
Source Code
I am trying to export word file to pdf via NET UNO API
(net_bootstrap.dll,net_uno.dll) with applied filters.
Used NET-Framework is 8.0.
I am always getting an AccessViolation:
System.AccessViolationException
HResult=0x80004003
Nachricht = Attempted to read or write protected memory. This is often an
indication that other memory is corrupt.
Quelle = <Die Ausnahmequelle kann nicht ausgewertet werden.>
Stapelüberwachung:
<Die Ausnahmestapelüberwachung kann nicht ausgewertet werden.>
This is the client test code i am using. LibreOffice is locally compiled
(becaus of missing net bindings in official release. see
https://bugs.documentfoundation.org/show_bug.cgi?id=165585 ).
I tried to use official release 25.2.2 and copied missing net comonents to the
program-directory, but issue is the same.
[CODE]
string strDoc;
XDesktop desktop = null;
XComponent doc = null;
strDoc = @"file:///f:/test.docx";
try
{
XComponentContext context = NativeBootstrap.bootstrap();
XMultiComponentFactory factory = context.getServiceManager();
desktop = Desktop.create(context);
XComponentLoader componentLoader = desktop.query<XComponentLoader>();
PropertyValue[] loadProps = new PropertyValue[2];
loadProps[0] = new PropertyValue();
loadProps[0].Name = "Hidden";
loadProps[0].Value = new Any(true);
loadProps[1] = new PropertyValue();
loadProps[1].Name = "ReadOnly";
loadProps[1].Value = new Any(true);
doc = componentLoader.loadComponentFromURL(strDoc, "_blank", 0, loadProps);
if (doc != null)
{
var storable = doc.query<XStorable>();
PropertyValue pageRangeValue = new();
pageRangeValue.Name = "PageRange";
pageRangeValue.Value = new Any("2-3");
pageRangeValue.Handle = -1;
List<PropertyValue> filterData = new();
filterData.Add(new PropertyValue( Name: "PageRange", Handle:-1 , Value:
new Any("2-3"), State: PropertyState.DIRECT_VALUE));
//filterData.Add(new PropertyValue(Name: "Quality", Handle: -1, Value:
new Any(100L), State: PropertyState.DIRECT_VALUE));
var props =filterData.ToArray(); ;
PropertyValue[] saveProps = new PropertyValue[2];
saveProps[0] = new PropertyValue();
saveProps[0].Handle = -1;
saveProps[0].Name = "FilterName";
saveProps[0].Value = new Any("writer_pdf_Export");
saveProps[1] = new PropertyValue();
saveProps[1].Handle = -1;
saveProps[1].Name = "FilterData";
saveProps[1].Value = new Any(props.ToArray());
storable.storeToURL(strDoc +".pdf",saveProps); // here crash happens
doc.dispose();
doc = null;
}
//desktop.terminate();
}
catch(System.AccessViolationException ex)
{
Console.WriteLine(ex.Message);
}
catch (ExternalException ex)
{
Console.WriteLine(ex.Message);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
finally
{
doc?.dispose();
desktop?.terminate();
}
[/CODE]
--
You are receiving this mail because:
You are the assignee for the bug.