Unhelpful error message when invalid resource key
See original GitHub issueDescribe the bug
Was trying to launch my application and getting a Error HRESULT E_FAIL has been returned from a call to a COM component.
message on start with no additional information or stacktrace as to what the problem was.
Turned out, I had a StaticResource
key referencing something that didn’t exist by mistake. It’d be great if VS could point this out ahead of time or the runtime error message be more useful here for debugging.
E.g.
<Style x:Key="TokenizingTextBoxItemTokenStyle" TargetType="controls:TokenizingTextBoxItem">
...
</Style>
<Style TargetType="controls:TokenizingTextBoxItem" BasedOn="{StaticResource TokenizingTextBoxItemStyle}"/>
See the mismatch above in the Key to StaticResource lookup.
Expected behavior Error message calling out no resource found with given key would at least be a pointer.
Error Details
System.Runtime.InteropServices.COMException
HResult=0x80004005
Message=Error HRESULT E_FAIL has been returned from a call to a COM component.
Source=<Cannot evaluate the exception source>
StackTrace:
<Cannot evaluate the exception stack trace>
Version Info
Windows 10 version | Saw the problem? |
---|---|
Insider Build (19615) | Yes |
November 2019 Update (18363) | |
May 2019 Update (18362) | |
October 2018 Update (17763) | |
April 2018 Update (17134) | |
Fall Creators Update (16299) | |
Creators Update (15063) |
Device form factor | Saw the problem? |
---|---|
Desktop | Yes |
Mobile | |
Xbox | |
Surface Hub | |
IoT |
Additional context Thought I had maybe filed a similar bug before, but couldn’t find it?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:6
- Comments:10 (3 by maintainers)
Top Results From Across the Web
azure - "Invalid Resource" message while trying to create a ...
I am trying to create an Azure Storage account using the Azure Resource Manager Connector in Logic Apps. But I am getting an...
Read more >Invalid resource name and type segments - Azure
Describes how to resolve an error when the resource name and type don't have the same number of segments.
Read more >User authorization failure with error "Invalid resource ...
On MacOS: press "fn + command + f2" keys; On Windows: press "Ctrl + F2" keys. question details.
Read more >Assertion Consumer Service URL tag not checked for invalid ...
Warning: Invalid resource key: The value of attribute "AssertionConsumerServiceURL" associated with an element type "samlp:AuthnRequest" must ...
Read more >3240175 - 'Invalid resource url' error in SAP API Management
In API Logs, you can see the following error: Failed to load resource: the server responded with a status of 400 (Bad Request)Log-dbg....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hit another case where I just got a unhelpful:
Coming from the ResourceDictionary type itself.
It was a case where I was trying to assign the wrong type of resource to another resource…
RainbowBrush
in this case was aLinearGradientBrush
, so loading this ResourceDictionary was failing at runtime, no indication that this was a problem or pointing me in the right direction… ☹Is this managed or C++? There should be stowed exceptions with more info (you might need to turn on mixed debugging). As for the original issue I had a resource that it did not really exist, we had planned to make changes to our compiler pipeline to detect these cases and give you a compile time error (similar for Binding and other related misfires).
Unfortunately this will only happen post WinUI 3.0, currently we’re shooting for tooling parity.