InDesign server COM error - com

I am using InDesign server on windows. And developing application using Microsoft .Net web platform (ASP.NET).
I am generating Indd file using ImportXML() method provided by InDesign. I am getting following error randomly (sometimes more often):
System.Runtime.InteropServices.COMException (0x0000FFFF): Exception from HRESULT: 0x0000FFFF
at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
at InDesignServer.Document.ImportXML(String From)
There is no more information provided by InDesign about where it fails so am blocked there.
Can anyone help here. Thanks.

I am not familiar with ASP.NET, but in ExtendScript it is importXML (starts with low case and case-sensitive)
Also, check the file path you are passing to the importXML.
Make sure the document is created and initialised before you import xml

After a long time. But, I became active again on 'Stack'.
This was the error due to in-appropriate permission in DCOM config.
See steps below to check:
1. From the Start menu, click Run and type Dcomcnfg.exe
2. Select 'Computers'
3. Select 'My Computers'
4. DCOM Config
5. Find InDesign COM component and select properties
6. In this set appropriate security and identity.
COM exceptions are always vague, hard to answer by anyone!

Related

Unhandle exception issue

We have a large app built using VB.NET VS2012. Every now and then when closing the app an unhandled exception occurs. Very random, sometimes it does it sometimes it doesn't.
The error is below.
System.InvalidOperationException was unhandled
HResult=-2146233079
Message=Invoke or BeginInvoke cannot be called on a control until the window handle has been created.
Source=System.Windows.Forms
StackTrace:
at System.Windows.Forms.Control.MarshaledInvoke(Control caller, Delegate method, Object[] args, Boolean synchronous)
at System.Windows.Forms.Control.BeginInvoke(Delegate method, Object[] args)
at System.Windows.Forms.WindowsFormsSynchronizationContext.Post(SendOrPostCallback d, Object state)
at System.Windows.Forms.AxHost.ConnectionPointCookie.Finalize()
InnerException:
We produce a dump file to try and find where this is originating but have had no luck. The debugger just shows No source code available. We are using some third-party controls. At this point we just want to find what is trying to create the control. If its a problem with the third party control and if we don't have that code, we can't fix it but maybe we can work around it. But we can't find what is trying to create control (when shutting down).
We have reviewed many web posts describing how to utilize the crash dump files but have had no luck identifying the control (or even the control type) that is generating this.. Just knowing the type would help narrow it down.
Any ideas how we can at least get the type of control or the originating caller or?
If enough info isn't provided please let me know and I will post what I can.
Posting code is not an option because we have no idea where the message is coming from.
Thanks in advance!
I should have added that we do use try catch blocks for just about everything. We also do have a logging procedure but we arent seeing any of these exceptions in the log file.

SHGetFileInfo causes Heap Corruption when using SHGFI_ICON

When I enable Page Heap for my process under test, it triggers an Access Violation which indicates to me some type of heap corruption has occurred when SHGetFileInfo is called.
The top of the call stack shows msvcr90!wcspbrk and walking down it shows COM-related items in ole32 until shell32 is reached where we call SHGetFileInfo.
From what I've found online, a common problem for weirdness using shell32 is not calling CoInitialize/CoInitializeEx first, but at this point CoInitializeEx() has already been called, and calling it immediately prior to the below code simply returns S_FALSE.
The below code is in our DLL which is PInvoked from .NET (the code is used to retrieve the icon used for a particular file):
SHFILEINFOW shfi;
memset(&shfi,0,sizeof(shfi));
SHGetFileInfoW(A2W("C:\\logfile.txt"),
FILE_ATTRIBUTE_NORMAL,
&shfi,
sizeof(shfi),
SHGFI_USEFILEATTRIBUTES
| SHGFI_ICON
);
(where logfile.txt is random text file on my root drive)
I've hard-coded the first parameter to a file on my machine for simplicity.
I'm using a 64-bit Windows OS, but the code is run in a 32-bit context. I get the same result if I use the narrow version of SHGetFileInfo.
If I disable Page Heap for my process, there is no problem.
When I don't use the flag SHGFI_ICON, the issue doesn't occur.
EDIT: #HansPassant requested I add a reproduceable sample, here's a link to a Visual Studio 2010 Win32 Console Application demonstrating the issue: sample

.NET 4.0 - CultureNotFoundException

I have migrated my ASP.NET MVC 2 project to VS 2010 + .NET 4.0.
Now when i start the application i get a lot of "CultureNotFoundException" in IntelliTrace and Output/Gebug window :
A first chance exception of type 'System.Globalization.CultureNotFoundException' occurred in mscorlib.dll
I know what "A first chance exception" means, but when i try to debug(added "CultureNotFoundException" into Bebug/Exceptions[Thrown]) why ex. is thrown i got this detailed exception text:
System.Globalization.CultureNotFoundException occurred
Message=Culture is not supported.
Parameter name: name
designer is an invalid culture identifier.
Source=mscorlib
ParamName=name
InvalidCultureName=designer
StackTrace:
at System.Globalization.CultureInfo..ctor(String name, Boolean useUserOverride)
InnerException:
I wonder why .NET is trying to create CultureInfo with name "designer"?
Isn't it bug?
I had a similar issue with the CultureName "UserCache". To resolve this I deleted all the folders from in here:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files
For other people that have this problem, this is usually an exception that is ignored.
Go to the Debug menu -> Exceptions... and ensure that you have everything unchecked for the Exception list.
This is actually by design in System.Web (at least up until .NET Framework v4.0), not necessarily the best approach, but it works.
You can find a more detailed description here, but it basically happens because ASP.NET checks every single folder to see if it contains satellite assemblies, and throws an exception otherwise.
Given that satellite assemblies live in folders with predictable names, one would wonder why they would decide to do this rather than only check folders that match the pattern, particularly since handling exceptions is rather expensive computationally compared to a simple conditional check.
I was curious as to the cause to see if there was something I could personally do to eliminate this particular annoyance.
The Exception is a side effect of calling, "System.Web.UI.Util.IsCultureName(name)"
The first time it's called in my MVC3 application is in regards to a directory called "UserCache", which is in the same directory as several directories with the expected culture names "en-US", etc. .Net is trying to find Satellite directories for the application.
It's called multiple times, even relating to files that are culture files, "EditorLocalization.bg-BG.designer.cs" for example (actually all of these that are in App_GlobalResources). [ What the code does here is to take all the files in App_GlobalResources, and see if the file ends in a CultureName, again calling IsCultureName.
So there's nothing you can really do to avoid this... In production where the .cs classes won't be there, perhaps it won't happen. It certainly slows down startup quite a bit, though!
In any case, in my mind it's a total bug that Microsoft throws an exception inside, "IsCultureName().
Go to the Debug -> Options in Visual Studio and check "Just My Code".
I found that turning on "Enable Just My Code" in the Debugging section of the Visual Studio 2017 options worked for me. That just hides those exceptions, which are part of the normal operation of the framework.
I had a similar issue with the "CultureNotFoundException". To resolve this I had to delete all the folders from in here additionally:
%LocalAppData%\Local\Temp\Temporary ASP.NET Files
Deleting from here wasn't enough:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files
I had this error message:
'ViewBag.XXXXX' threw an exception of type 'System.Globalization.CultureNotFoundException' dynamic {System.Globalization.CultureNotFoundException}
The inner message said:
The culture is not supported.\r\nParameter name: name\r\nneutral is an invalid identifier culture.
The problem was that there was an invalid definition of the assembly culture in the AssemblyInfo.cs file:
[assembly: AssemblyCulture("neutral")]
To fix it, just leave empty the "culture" parameter like this:
[assembly: AssemblyCulture("")]
That fixed the problem for me.
I think it's the actual designer that messed things up. Try searching across your solution for "designer" string to see if any XML/HTML attributes have their values set to this string.
It seems as the problem was a bug in VS 2010 Beta 2.

FileInfo..ctor(string fileName) throwing exception: bug in SL 4.0 or .NET 4.0?

The following test case passes in .NET 4.0:
var fiT = new FileInfo("myhappyfilename");
Assert.IsNotNull(fiT);
... but fails in Silverlight 4.0 with the following error:
System.ArgumentNullException: Value cannot be null.
Parameter name: format
at System.String.Format(IFormatProvider provider, String format, Object[] args)
at System.Environment.GetResourceString(String key, Object[] values)
at System.IO.FileSecurityState.EnsureState()
at System.IO.FileInfo.Init(String fileName, Boolean checkHost)
at System.IO.FileInfo..ctor(String fileName)
Either the failure is a bug in SL 4.0, or the non-failure is a bug in .NET 4.0. Anyone know which it is?
(For the record, I'm running SL 4.0 on VS 2010 RC, which may be contributing to the problem).
See the MSDN documentation for FileInfo for Siverlight 4:
When it is called by an elevated-trust
application, provides instance methods
for the creation, copying, deletion,
moving, and opening of files, and aids
in the creation of FileStream objects.
This class cannot be inherited.
Chances are your application isn't running with elevated trust. If you want to access those restricted methods, it'll need to be.
As to why it's returning a null - that may well be a bug, possibly an improperly propagated SecurityException. Then again, it may be as designed - the docs are also still pre-release. EDIT: gabe's answer is most likely correct on this point.
Since you generally can't access the filesystem from Silverlight (you need a fully-trusted OOB app), it looks like SL4 is trying to throw an exception, but is failing because the text for that exception isn't available in the SL4 beta. Presumably you would get the correct exception once SL4 is released.

out of process COM server throws error 217

I've created a COM object using NATIVE c++ - both COM object and it's native client works perfectly.
the next step was to implement the COM object as a out of process COM server( hosted by the dllhost process.
I followed the standard registry-change procedure(http://support.microsoft.com/kb/198891) and both client and COM server started to work properly under the dllhost.exe process.
However, I can see that sometime the host server crashes and the dllhost.exe pop up a message stating error 217 - nothing else is detailed.
Any idea how can I debug the COM infrastructure? any preferred tools I can use?
many thanks,
Ofer
However, I can see that sometime the
host server crashes and the
dllhost.exe pop up a message stating
error 217 - nothing else is detailed.
I'm curious as to what happens here, in more detail -- does the dllhost process really crash (with a structured exception) or does it show a message box and then die?
You should be able to attach any debugger (Visual Studio or WinDBG) either when the problem happens or at any time in advance.
Break into the debugger and check the callstack when the problem occurs.
If it's due to a race condition of some kind, it may not surface when the debugger is attached, so I'd start with attaching when the message box is shown, and see what information can be gathered from there.
Presumably your code is in the callstack; if not, you may be short on luck.
Note that it always helps to have Microsoft symbols available, it's easiest via the public symbol server as described at the bottom of this page:
http://www.microsoft.com/whdc/devtools/debugging/debugstart.mspx