Warning: The object was not found using the test object description. Check the object's properties - hp-uft

I'm currently studying UFT. I encountered this: I have one object, which is a textbox field on my repository. I used that specific object twice on my script. The warning then occurs. "The object was not found using the test object description. Check the object's properties." May I know what to do so that warning will no longer occur?

This warning means that UFT was not able to identify the object using the primary description it stored and that a fallback method called Smart Identification was used.
This means that the identification properties that you're currently using (either Object Repository or descriptive programming) are out of sync with your web application and it's recommended that you update the description (perhaps by adding regular expressions).
The report should list which properties where used by Smart Identification and which were skipped), this may be a good starting point to choosing your description.

Related

What are the security concerns with static code analysis warning CA2104?

I recently ran static code analysis in Visual Studio on a solution and saw a line get flagged for CA2104. Mutable object marked as ReadOnly. I understand why it doesn't make sense to have a mutable type set as ReadOnly, since the properties on the object can change, but I don't understand why this is considered a security problem.
This seems more like a data integrity/code quality problem. The only security related thing that comes to mind is if the user was able to somehow change the properties, they could potentially make the object behave in a different manner, but wouldn't this be true for any mutable object? What am I missing?
Edit: I see that this was marked as a possible duplicate. I read through the linked question, but I do not feel that this answers my question. I understand what the CA2104 warning is saying, however I don't understand why this is categorized as a security issue. This is what I am trying to understand.
Having read the documentation on this. I believe that the warning is raised because although the property is marked read-only. There's nothing preventing the user from changing the properties on the read-only property.
Where user would be the consumer of the assembly/library containing the parent type.
Since the property is read-only it's probably been set because the author doesn't want the property to be changed/re-assigned but there's nothing to prevent any of the properties on the child object from being changed. Which is counter to what read-only means. Hence the warning
I suppose it's a tenuous link to security but still valid if the library author wants to protect the exposed object without allowing it to be modified but that's not what is actually happening.

TSqlObject has no ContextObject property?

I'm attempting to create a T4 template that generates source code for calling stored procedures that are contained in another project in my solution. I am able to successfully enumerate the .sql files in the solution, add them to a TSqlModel, and use that model to retrieve the list of stored procedures as TSqlObject instances. Now, I need to enumerate the parameters for each stored procedure, and this is where I'm getting hung up.
When I debug my template, I can see that the TSqlObject instances have a ContextObject property, and this property contains, among other things, the list of parameters that I need to generate my code. When I attempt to access this property from my template, however, the compiler complains that the property doesn't exist:
Error 1 Compiling transformation: 'Microsoft.SqlServer.Dac.Model.TSqlObject' does not contain a definition for 'ContextObject' and no extension method 'ContextObject' accepting a first argument of type 'Microsoft.SqlServer.Dac.Model.TSqlObject' could be found (are you missing a using directive or an assembly reference?) d:\Code\cs\test_sproccodegen\CallingProject\sproc_template.tt 34 111 CallingProject
I can definitely access this ContextObject property from the Immediate window while debugging, but it is not available at compile time.
What am I doing wrong?
The property isn't listed in the API, which probably means it's internal or private. Only public and protected accessible members are included in the docs.
Checking it out in JustDecompile, you can see it is, in fact, internal.
That's an internal method as mentioned by Will in the question comments. You should use the public APIs instead. The following documenation should help you get started:
Model API Reference
Public Model Tutorial
Dac samples project. There aren't any T4 template examples but it has a lot of examples of querying and even manipulating the model. You just need to put that in T4 template form.

How to use IProjectionBuffer in MEF without creating editor instance?

I am trying to create a Visual Studio extension which handles a multi-language content type. Much like some mvc-templates and Django or ASP.NET which a certain part of the code is in another language.
I know that I should use Projection and I already checked Django for Visual Studio extension but the solution there includes creating a Language Service and going to the trouble of creating all bits and pieces related to a code editor. Here I am trying to achieve the same goal just by using MEF.
I know that you can use IProjectionBuffer CreateProjectionBuffer() to create a projection but the question is how to replace the current TextBuffer with the created one and when is the best time to do it.
Also one may expect that if he specifies a base definition of type "projection" like this:
[Export]
[Name("Whatever")]
[BaseDefinition("code")]
[BaseDefinition("projection")]
internal static ContentTypeDefinition WhateverContentType = null;
the received TextBuffer in providers to be of type IProjectionBuffer (after all IProjectionBuffer is inherited from ITextBuffer). Which are not and it seems that a projection base definition has no effect what so ever.
So if I want to rephrase my question in a tldr version:
How and when do you apply an IProjectionBuffer to current view (using MEF and without creating an editor instance)?
So if I understand your question correctly, the answer is "you don't." A IWpfTextView is bound to a implementation of ITextBuffer (or a derived type, like IProjectionBuffer) at creation time, and can't be changed. Even if you could, many other extensions and language services would be most surprised by this and would probably crash.
To address your second question about content types: simply declaring you have a base content type of "projection" doesn't make you a projection buffer. All that really states is you might be creating projection buffers of that type, and when you do you want some extra ITagger support so taggers project through to the source buffers as you might expect them to.

GetExportedTypes() on an assembly throws NotSupportedException

I'm having some serious troubles getting a Windows Phone 7.5 class library to load into the WP Unit Test Framework. It internally calls GetExportedTypes() on my assembly which throws a ReflectionTypeLoadException that doesn't contain any details. Its message is "ReflectionTypeLoadException" and its LoaderExceptions is null ("Could not evaluate expression"). The assembly is not using any 3rd party assemblies. If I create a separate WP7 app and do the same thing, I get the same results. I'm a very experienced Reflection user, but the lack of any detailed errors has brought my research to a complete halt. Just for completeness, it's the Windows Phone version of Fluent Assertions.
What about the Types array on the exception? Does it contain values? If so, does it also contain nulls? If so, you can find out which classes failed to load: You know all classes in the assembly and you know which classes loaded correctly. Those that are missing are the classes that couldn't be loaded. Maybe this info gives some clues.
This answer is based on the documentation, especially these bits:
From the Remarks of the LoaderExceptions property:
The LoaderExceptions property retrieves an array of type Exception that is parallel to the Types array. This array will contain null values whenever reflection cannot load a class.
And from the documentation of the Types property:
An array of type Type containing the classes that were defined in the module and loaded. This array can contain some null values.
I've found it! #GeertvanHorrik pointed me at a blog post he recently wrote. I was using an covariant interface (using the out parameter) which the runtime (!) doesn't support. Why the compiler does not protect me from that is a big mystery (and a huge disappointment) to me

Generate sequence diagram fails with VS2010 - Object reference not set to an instance of an object

Every time I try to generate a seqeuence diagram I get that "Object reference not set to an instance of an object" from Visual Studio 2010.
I searched google, found some people also posting this error but no straight answer. Also, most people didn't have this bug all the time, while I always get it. Even on a clean new project.
Any ideas?
I was able to get past this error by changing the way my method signature was written before trying to generate the sequence diagram.
when I was getting the error it was written as such:
ClassName1 IInterfaceName.SubmitData(string username, string password, string data)
I changed it to:
public ClassName1 SubmitData(string username, string password, string data)
and it let me generate the diagram
perhaps this is something to do with interfaces and explicitly stating that the method is public?
HTH!
This topic has information about this issue:
A blank sequence diagram is generated after the following message is displayed:
"Object reference not set to an instance of an object."
This issue occurs when a sequence diagram is generated from an explicit implementation of an interface method, and the diagram is not added to the source project automatically. > An explicit implementation precedes the method name with the interface name
and a period (.).
For example, this issue occurs when you generate a sequence diagram from the following
signature and do not add the sequence diagram to the project automatically:
void ILinkedWorkItemExtension.OnWorkItemCreated() {}
Sequence diagram can not reverse all methods !!
Sometimes the method nature or other instances makes it impossible.

Resources