LongPath issue on WPF Drag Drop Getting Error: Error HRESULT E_FAIL has been returned from a call to a COM component - wpf-controls

In WPF, when I drag and drop a file with Long path that has more than 260 characters, it's throwing an error: Error HRESULT E_FAIL has been returned from a call to a COM component. Please let me know how to handle this. Is there any way to get invalid path and prompt for user.

Related

Change project file name in Xcode 10

I am trying to change a Project name in Xcode 10 and I have tried all the suggested methods I could find;
Rename project
Rename the Scheme
Rename the folder with your assets
Rename the Build plist data
I do all the above steps and the project complies and builds with out issues.
When I load the app on a iPhone, it crashed when I select a specific screen and I get the following errors;
2019-07-29 17:56:13.315622-0400 SkeetLauncher_RevA[736:163909] Unknown class _TtC14SKEET_LAUNCHER13launchButtons in Interface Builder file.
2019-07-29 17:56:13.363768-0400 SkeetLauncher_RevA[736:163909] [Graphics] UIColor created with component values far outside the expected range. Set a breakpoint on UIColorBreakForOutOfRangeColorComponents to debug. This message will only be logged once.
2019-07-29 17:56:13.372489-0400 SkeetLauncher_RevA[736:163909] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIViewController 0x101d01910> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key DELAY.'
*** First throw call stack:
(0x18f237ea0 0x18e409a40 0x18f15197c 0x18fbe320c 0x1bbce65e4 0x1bbf5fa5c 0x18f121748 0x1bbf5c6cc 0x1bbced25c 0x1bbcedc08 0x1bbceded0 0x1bbcee63c 0x1bbc46e28 0x1bbc5b8e8 0x1bbc5cdbc 0x1bbc3efac 0x1bc75aea4 0x19382ac70 0x19382fc00 0x19378e718 0x1937bd04c 0x1937bdeb4 0x18f1c77a8 0x18f1c243c 0x18f1c29dc 0x18f1c21cc 0x191439584 0x1bc2b5054 0x100c453f4 0x18ec82bb4)
libc++abi.dylib: terminating with uncaught exception of type NSException.
The project compiles and runs fine before I do the rename process.
Go into the storyboard and reenter all the view controller class names.
That didn't work but it pointed me in the right direction, Thanks
I had to change the "Module" for "Custom Class" in identity inspector. I guess the "Change Project Name" process didn't automatically do it for all the view controllers. Attached is picture for clarification.
MODULE in Identity Inspector

OPOS_E_NOSERVICE after return from DllGetClassObject() in simple ATL COM OPOS Service Object

An example MSR OPOS Service Object I am writing was not initializing properly. I am adding this question to help others who run into the same problem since various searches resulted in no help whatsoever.
My question is: How can I determine what method in an OPOS Service Object is missing? Is there a utility of some kind that can exercise an OPOS Service Object and tell me what is missing? Is there some way to determine what methods an interface is expected to provide and which are missing?
I am following the procedure in Writing an OPOS Service Object using ATL in order to learn how an OPOS Service Object is created. I am using Visual Studio 2005 under Windows XP. To test the basic functionality I am using the NCR Retail Services Manager (RSM) utility to create a profile for an MSR in order to test the basic functionality of a Mag Stripe Reader simulator Service Object.
The Visual Studio project creates the COM object and registers it properly. When I attempt to use the Diagnostics function of RSM on the Service Object profile I receive an error of OPOS_E_NOSERVICE. I have created a log file logging function in the COM object which shows that the Service Object is loaded, the DLLMain() function of the COM object is invoked and the DLLGetClassObject() is invoked. However a second log file which logs the various Service Object interface methods is not created indicating that none of the Service Object interface methods are called.
So it appears that there is a problem with the Service Object interface which fails a check that is done at the time the COM object is loaded.
The DllGetClassObject() function is generated by the Visual Studio ATL project wizard and should require no changes.
Using the Microsoft POS .NET sample utility which comes with POS .NET 1.12 I tried using the sample utility. I can see the profile created with NCR RSM in the tree control under the MSR node. However when I attempt an Open there is an error message. The Windows Event log shows the follow error.
Microsoft.PointOfService.PosControlException: Method Open threw an
exception. The service object does not support one or more of the
methods required by its release.
I finally found the missing method from inspection and review of the code. It turns out that there was a single missing method, OpenService() which the Visual Studio 2005 ATL interface wizard had not created properly, possibly because it was the first method to be added to the interface for the Service Object.
When I attempted to add this method to the interface using the Visual Studio class wizard, the wizard issued an error message after I entered the method signature into the wizard dialog and pressed the Next button.
When retrying from scratch with a new ATL project, the error dialog had the following text:
Add/Remove operation is impossible, because the code element
'OpenServiceW' is read only.
While the method did show in the Visual Studio UI in the Class View when clicking on the method, the interface definition in the .idl file showed it as empty.
interface IVirtSo : IDispatch{
};
I closed Visual Studio then reopened the project and tried to add it again this time getting the error message:
Failed to return new Code Element. Possibly syntax error. New Element
Name: OpenService
Further investigation indicates that there is an OpenService() method in the Windows API and it may be that Visual Studio 2005 ran into a conflict between my trying to add this method to my Service Object and it existing in the Windows API (actual name appears to be OpenServiceW()).
What I finally ended up doing was to add an interface method with the same signature, named CheckService() using the class wizard and then changed the interface method name everywhere it existed in my generated code to OpenService() including a couple of places where CheckService was part of a name or label. For some reason the Visual Studio class wizard thought the interface method of OpenService() existed when in fact it did not.
However before I was able to do this successfully, I had to first exit Visual Studio then delete the Intellisense files (.ncb file and .suo file) so that adding new methods using the Class View wizard would work properly. Before deleting the files, the id number of the Add -> Method in the wizard kept incrementing even with the method add failing. After deleting the Intellisense file the id number started at 1 again and I was able to add the CheckService() method with the wizard and then modify the method name to OpenService() by hand using the Find tool with "Match case" turned on and "Match whole word" turned off.
The only way that I can see thus far is to review the OPOS Service Object specification against the source code implementation of the Service Object.
I am looking for other possible solutions to finding methods are missing from an OPOS Service Object.
From the article and my current experience, it appears that the following are the common subset of methods that need to be available in an OPOS Service Object in order for the Service Object to load properly. Some of these are invoked only once as a part of starting up and initialing the Service Object. Others, such as GetPropertyNumber() and GetPropertyString() as well as the SET versions of these may be invoked multiple times as part of setting up the Service Object environment. There may be other entry points offered by a particular OPOS Common Controls object for a particular device type that would need to have a corresponding method in the Service Object.
HRESULT OpenService(BSTR DeviceClass, BSTR DeviceName, IDispatch* pDispatch, [out, retval] long* pRC);
HRESULT CheckHealth(long Level, [out, retval] long* pRC);
HRESULT ClaimDevice(long ClaimTimeout, [out, retval] long* pRC);
HRESULT ClearInput([out, retval] long* pRC);
HRESULT CloseService([out, retval] long* pRC);
HRESULT COFreezeEvents(VARIANT_BOOL Freeze, [out, retval] long* pRC);
HRESULT DirectIO(long Command, [in, out] long* pData, [in, out] BSTR* pString, [out, retval] long* pRC);
HRESULT ReleaseDevice([out, retval] long* pRC);
HRESULT GetPropertyNumber(long PropIndex, [out, retval] long* pNumber);
HRESULT GetPropertyString(long PropIndex, [out, retval] BSTR* pString);
HRESULT SetPropertyNumber(long PropIndex, long Number);
HRESULT SetPropertyString(long PropIndex, BSTR PropString);

unrecognised exception in windows C++ code

We have a number of sections of code in the format:
try
{
// code
}
catch(std::exception &e)
{
// log exception
}
catch(...)
{
// log unknown exception.
}
Every so often, the unknown exception code triggers, and logs an unknown exception.
I always thought that all exceptions were meant to derive from std::exception, and thus catching std::exception would catch all exceptions.
Is there some other exception that I should be catching?
If my code ends up in the unknown exception handler, is there any way that I can find out what exception was actually caught?
edit
We managed to locate the cause of the problem- despite saying that they had, the customer had not installed .NET 3.5, which our code depends on, and the system fell over when trying to use the XML parser.
Is there some other exception that I should be catching?
This depends on your code. Libraries you call can throw exceptions not derived from std::exception, examples are MFC's CException or Microsoft's _com_error. Also, an access violation might be catched by catch(...), which is the reason why I would not use catch(...) in my code - it's just to broad for me.
2.If my code ends up in the unknown exception handler, is there any way that I can find out what exception was actually caught?
You can run your code in the debugger and configure the debugger to break your program when the exception is thrown (first chance). Then you know exactly which line of code triggers the exception and should be able to see what exactly is thrown.

Visual Studio extension - creating project type

I'm trying to create a new Visual Studio project type following the tutorial:
http://msdn.microsoft.com/en-us/library/vstudio/cc512961.aspx
Unfortunately I'm getting a strange exception stating that "Guid should contain 32 digits and 4 dashes".
The error appears somewhere along the lines:
// Launch the aggregate creation process (we should be called back on our
IVsAggregatableProjectFactoryCorrected implementation)
IVsCreateAggregateProject aggregateProjectFactory =IVsCreateAggregateProject)this.Site.GetService(typeof(SVsCreateAggregateProject));
int hr = aggregateProjectFactory.CreateAggregateProject(guidsList, fileName, location, name, flags, ref projectGuid, out project);
if(hr == VSConstants.E_ABORT)
canceled = 1;
ErrorHandler.ThrowOnFailure(hr);
I 've got no idea what I'm doing wrong and how to debug this. ErrorHandler just throws exception.

SPException: Catastrophic failure (Exception from HRESULT: 0x8000FFF (E_UNEXPECTED) in Sharepoint

I've been trying to programmatically copy custom content type and its custom columns from one web to another for some time now, and I always get different errors or exceptions every time. After yet more tries, I received more strange and cryptic exception from Sharepoint after clicking onto a newly copied custom column in a custom content type. I checked the logs, and this is what I got:
Unknown SPRequest erorr occurred. More information: 0x80070002
Unable to locate the xml-definition for FieldName with FieldId 'guid without braces', exception: Microsoft.SharePoint.SPException: Catastrophic failure (Exception from HRESULT: 0x8000FFF (E_UNEXPECTED)) ---> System.Runtime.InteropServices.COMException...
... at Microsoft.SharePoint.Library.SPRequestInternalClass.GetGlobalContentTypeXml(String bstrUrl, Int32 type, UInt 32 lcid, Object varIdBytes...
Failed to find the content type schema for ct-1033-0x1000blahblahblahcontenttypeId while caching feature data.
Unknown SPRequest error occurred. More informationL 0x8000ffff
Unable to locate the xml-definition for CType with SPContentTypeId '0x0100MorecontenttypeId', exception: Microsoft.SharePoint.SPException: Catastrophic failure(Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED)) ---> System.Runtime.InteropServices.COMException (0x8000FFFF): Catastrophic failure...
... at Microsoft.SharePoint.Library.SPRequestInternalClass.GetGlobalContentTypeXml(String bstrUrl, Int32 type, UInt 32 lcid, Object varIdBytes...
It failed to find quite a few content type schema. I'm confused with what Sharepoint is trying to do here, and why a simple process of copying a custom content type from one web to another just wouldn't work in contrast to the information found on the web e.g. this.
Appreciate any help to get over this problem. Thanks.
Content types are defined in XML files that has to reside on the file system (in the 12 hive). If you want to copy a content type from a web application to another, you must make sure that these definitions are also copied.
I would recommend you to install the feature that contains these custom content types on each of your target web applications.
Regards,
M

Resources