I am attempting to create a new COM object in my DLL using the ATL Simple Object Wizard in Visual Studio 2005.
I enter the short name for the object, and all of the other fields are derived.
However, when I click Next in the wizard, the following error message comes up:
Object 'IXxxInterfaceName' already exists
I have searched my entire solution for all references to IXxxInterfaceName and can't see it defined anywhere.
How is the wizard determining that it exists already?
I never found out why the wizard determined that the object name existed already - I'm guessing something was cached somewhere that I couldn't track down.
In the end, I appended a 2 to the end of the interface name when creating it which allowed it to be added. Then I replaced all the occurrences of IXxxInterfaceName2 with IXxxInterfaceName. Everything worked after this.
If I ever track down the root cause of this problem, I'll update the answer.
Is it defined in a library you are referencing?
Also happens in VS 2008. However Clean solution and Clean project from build option solves this :-)
Related
I have created a brand new database project in VS 2017. I have set the target platform to SQL Server 2016 and have added master and msdb as references.
The issue I am having is that I have a view that references sys.availability_groups and filters on the column is_distributed. It is throwing this error:
SQL71561: View: [dbo].[VUHL_vw_AGInfo] contains an unresolved
reference to an object. Either the object does not exist or the
reference is ambiguous because it could refer to any of the following
objects: [master].[sys].[availability_groups].[AG]::[is_distributed],
[master].[sys].[availability_groups].[is_distributed],
[master].[sys].[availability_replicas].[AG]::[is_distributed],
[master].[sys].[dm_hadr_availability_group_states].[AG]::[is_distributed],
[master].[sys].[dm_hadr_availability_replica_states].[AG]::[is_distributed]
or
[master].[sys].[dm_hadr_database_replica_states].[AG]::[is_distributed].
I know the column exists, and I know that it didn't used to exist prior to 2016 and I asked this question. However, even with that workaround it won't recognize the column.
Is there a way to get the database project to recognize the column, or to tell it not to care?
I'm not 100% certain what I've done to get this working now, but it's now working.
Essentially, I closed and reopened VS and saw that somehow master and msdb were added twice as references. I removed all of those references, saved, and closed VS. I then reopened the project, added the references, and now it's working.
I'm trying to use Visual Studio's unit test generation feature. The first thing I found was this extension, but for some reason it doesn't work - even after rebooting, though I can verify the extension is installed, "Generate Unit Test" doesn't show up in the context menu when I right-click within a method.
The next thing I tried was a workaround I found in one of the reviews - apparently the original feature still exists, just buried. The workaround is:
Tools->Options
Environment->Keyboard
Show commands containing 'unit'
Attach a shortcut to "EditorContextMenus.CodeWindow.CreateUnitTests".
But that didn't work, either - as in, nothing seems to happen. There are two other commands that may be relevant - EditorContextMenus.CodeWindow.GenerateUnitTests and Project.AddUnitTest. Neither of those work either - the latter just does nothing, the former gives me the error "Controller must have testable element property set up".
So... I'm not really sure what else to try.
I have a same problem, and here is reason why the error occurred.
In the documentation of code generator, the arthor metions an super important pre-requisite.
In the final release we require a public class and at least one public method, before the Generate Unit Test feature lights up.
http://blogs.msdn.com/b/willy-peter_schaub/archive/2013/07/19/exploring-the-unit-test-generator-vs-extension-v1-rc.aspx
From the article, I have found that there is two requirements make the Code Generator works.
The class must be public
At least one public method in the class
You can try to make the Access modifiers to Public to solve the problem
Apparently the extension doesn't work for structs, I found out today - no matter what you do, you get the "Controller must have have testable element property set up" error.
Our application has a number of widgets that use templates that are generated on the fly via a JSP.
In the front-end code, they are included using the dojo/text plugin. This ensures that Widget lifecycle isn't kicked off until the template has been resolved and it works just fine.
Unfortunately, when we try to perform our build, we get a 311 error:
error(311) Missing dependency. module:
app/navigation/NavigationManager; dependency:
dojo/text!/author/app/templates/NavigationManager-content.html; error:
Error: text resource
(/author/app/templates/NavigationManager-content.html/x) missing
I understand what's happening here, the build process is trying to internalize the string, but when it goes to look for it, it can't locate it and so flags it as a missing dependency.
I see a number of options here:
Somehow, tell Dojo to ignore this missing dependency - this would be fine, but I'd need to be able to be specific, so that I get alerted to any other dependencies that might be missing
Somehow, tell Dojo not to try and internalize this template - this would also be fine, since there's nothing to internalize here.
Somehow, stub out the dependency so that the dependency resolution passes, but the internalization doesn't occur.
I've seen references to the
internStringsSkipList
value, but none of the following helped:
internStringsSkipList: ['/author/pepper/templates/NavigationManager-content.html']
internStringsSkipList: ['dojo/text!/author/pepper/templates/NavigationManager-content.html']
internStringsSkipList: ['/author/pepper/templates/NavigationManager-content.html/x']
Any suggestions?
I faced exactly the same problem and after reading lots of dojo documentation and source code I came to the conclusion that it's very difficult if almost impossible to do. There is, however, a very simple and elegant workaround. But before telling you how to solve the problem firstly why there is a workaround needed in the first place (so you can adjust the solution to your own circumstances):
First issue, the resource is undiscoverable
According to the Overview section of the dojo build system Reference Guide:
[The build system] “discovers” a set of resources and then applies a synchronized, ordered set of resource-dependent transforms to those resources. (…) When a resource is discovered, it is tagged with one or more flags that help identify the role of that resource. (…) After a resource is discovered and tagged, the system assigns a set of transforms that are to be applied to that resource.
So in short, any resources generated on the fly can't be discovered by the build system because they don't reside on the file system. If they can't be discovered, then they can't be tagged and no transformation can be applied to it. In particular, resourceTags is not called for such resources and you can't put them on the exclude list of a profile layer definition (compare section Layers in Creating Builds).
BTW, as far as I understand the documentation to depsScan transform, internStringsSkipList can only be used to skip resources specified using the legacy notation (dojo.something, e.g. dojo.moduleUrl).
Second issue, the plugin resolver expects a physical file
Notation dojo/text!/some/url says to use the dojo/text.js component as a plugin. I found this note in this ticket:
Every AMD plugin should have a plugin resolver in util/build/plugins and have it registered in util/build/buildControlDefault.
If you check util/build/plugins/text.js (e.g. on Github) you'll see that the error is being thrown because the dependency (that part after dojo/text! is stored in moduleInfo) is not in the resources array:
textResource = bc.resources[moduleInfo.url];
if (!textResource){
throw new Error("text resource (" + moduleInfo.url + ") missing");
}
And this is precisely because the resource couldn't be discovered during the "discovery" phase.
The difficult solution
In the difficult solution, that might or might not work, you would need to change how the transformation depsScan works. Basically, when depsScan encounters dojo/text!/some/url it calls the plugin resolver to check if the dependency exists. From the depsScan documentation:
Once all dependencies are found, the transform ensures all dependencies exist in the discovered modules. Missing dependencies result in an error being logged to the console and the build report.
That might be possible by redefining transformJobs to contain a custom transform for depsScan. See util/build/buildControlDefault.js (on Github) and this forum post for more insights.
The simple workaround
Just create your own plugin to load the resource. Your own plugin won't have the plugin resolver registered (see the second issue above) and all you'll get when compiling is the dreaded
warn(224) A plugin dependency was encountered but there was no build-time plugin resolver.
This is my example of such plugin that loads a JSON resource dynamically:
define(["dojo/text", "dojo/_base/lang", "dojo/json"],
function(text,lang,json){
return lang.delegate(text, {
load: function(id, require, load){
text.load(id, require, function(data){
load(json.parse(data));
});
}
});
});
It reuses dojo/text adding its custom load function. This is an adaptation of another example posted on this dojo-toolkit forum post. You can see their code on JSFiddle.
In my project I use the plugin like this:
define(["./json!/path/to/an/json"],
function(values){
return values;
});
Your plugin can just return the loaded template without parsing it as JSON, and as long as you don't specify your custom plugin resolver (which would expect the file to exist physically on disk) the project will compile fine.
This wasn't your issue, but the most common solution to those facing the error(311) problem is going to be this:
Don't start template paths with a slash.
Bad:
"dojo/text!/app/template/widget.html"
Good:
"dojo/text!app/template/widget.html"
Your template path isn't a normal, plain-ol' URL. It's still part of the Dojo build, so you use Dojo build pathing to get to the template.
I'm using RazorGenerator to unit test my Razor/MVC3 per David Ebbo's post here http://blog.davidebbo.com/2011/06/unit-test-your-mvc-views-using-razor.html and every time I attempt to use the AntiForgeryToken HtmlHelper (with no method arguments), it throws a NotImplementedException. What gives? As best I can tell, both my cshtml file and the view.generated.cs the correct method in System.Web.Mvc.dll, in the System.Web.Mvc namespace's HtmlHelper class. I've downloaded the latest source for the RazorGenerator project and don't see the word "forgery" contained within it anywhere, so I don't think I'm getting confused about exactly which HtmlHelper.AntiForgeryToken() method I'm hitting.
The code sample of my unit test follows:
[Test]
public void Index_RendersView()
{
var view = new Index();
// For test to succeed, this should not throw exception
view.RenderAsHtml();
}
Pretty basic. I'll spend some time digging under the hood to figure this one out and will follow up here if I figure this one out, but in the meantime I'm wondering if anyone else has encountered this and already worked out a solution.
I corresponded with David Ebbe, one of the (or, the) project owners on CodePlex, and he altered something within the RazorGenerator project source to fix this. Remarkably, he had it fixed within less than 1/2 hour of me asking the question on the CodePlex board.
I'm going to vote to have this question deleted since I don't think there's any value to keeping it around this site.
Im currently using ie as an active x com thing on wxWidgets and was wanting to know if there is any easy way to change the user agent that will always work.
Atm im changing the header but this only works when i manually load the link (i.e. call setUrl)
The only way that will "always work," so far as I've been able to find, is changing the user-agent string in the registry. That will, of course, affect every web browser instance running on that machine.
You might also try a Google search on DISPID_AMBIENT_USERAGENT. From this Microsoft page:
MSHTML will also ask for a new user
agent via DISPID_AMBIENT_USERAGENT
when navigating to clicked hyperlinks.
This ambient property can be
overridden, but it is not used when
programmatically calling the Navigate
method; it will also not cause the
userAgent property of the DOM's
navigator object or clientInformation
behavior to be altered - this property
will always reflect Internet
Explorer's own UserAgent string.
I'm not familiar with the MSHTML component, so I'm not certain that's helpful.
I hope that at least gives you a place to start. :-)
I did a bit of googling today with the hint you provided head geek and i worked out how to do it.
wxWidgets uses an activex rapper class called FrameSite that handles the invoke requests. What i did was make a new class that inherits from this, handles the DISPID_AMBIENT_USERAGENT event and passes all others on. Thus now i can return a different user agent.
Thanks for the help.
Head Geek already told you where in the registy IE will look by default.
This is just a default, though. If you implement [IDocHostUIHandler::GetOptionKeyPath](http://msdn.microsoft.com/en-us/library/aa753258(VS.85%29.aspx) or [IDocHostUIHandler2::GetOverrideKeyPath](http://msdn.microsoft.com/en-us/library/aa753274(VS.85%29.aspx), IE will use that registry entry instead.
You'll probably want to use SysInternal's RegMon to debug this.