TFS API - Object not set to reference of an object Error - tfs

I'm using the TFS api to pull data on some projects into a localized database. Recently this stopped working. and gave us this error.
Object Not Set to Reference of an Object
AND
Null reference exception at the Domain level (this fails the moment it connects)
We are pulling down the hierarchy.
Domain - Collection - Project - Requirements... etc.
Debugging I find that I the code can see the domains but not grab them or anything under them. I am perplexed as to what might have caused this. Our dlls are all up to date with the version of TFS being used (Version 12). Thought it might be a credential issue, but this occurs with any credentials used. I've read that it could be a cache issue with the server side credentials somehow. But I do not have access to this.
I would post code, but I am unsure which part would be the most helpful as the connector method works... just fails when it connects so the problem appears to be elsewhere.
Thoughts?
UPDATE:
I have detected the line of code where we have a failure... but walking through it the code detects all TFS items. Domains, test cases, projects. Everything.
But will always return the Null Reference Exception. Keep in mind this has worked seemlessly for months.
Domain dbDomain = server.Domains.DefaultIfEmpty(null).FirstOrDefault(a => a.DomainId.Equals(domain.DomainId));

Okay so the stupid mistake was in the Lambda expression. It was returning null because it was trying to calculate before a value was assigned. Silly me.
Domain dbDomain = server.Domains.DefaultIfEmpty(null).FirstOrDefault(a => a.DomainId.Equals(domain.DomainId));
Should be:
Domain dbDomain = server.Domains.Where(a => a.DomainId.Equals(domain.DomainId))DefaultIfEmpty(null).FirstOrDefault();

Related

Error 2002 : The EntityContainer 'X' for the storage model specified as part of this MSL does not exist in MetadataWorkspace

I'm trying to integrate my Oracle Database into my ASP.NET app, but I keep getting this error :
Error 2002: The EntityContainer 'OracleDBTargetContainer' for the
storage model specified as part of this MSL does not exist in
MetadataWorkspace.
I've tried everything I could think of but still can't figure out what's wrong.
What can I do to diagnose the root cause of this?
This is still new to me so I might miss something very obvious.
I'm assuming it my not like my database as the Diagram displayed when I integrated another DB. I've checked the foreign keys, primary keys, ... but to no good.
Using VS2013 with ODP.NET 12c Release 3.
EDIT : My EntityContainerMapping is empty, is that normal?
<EntityContainerMapping CdmEntityContainer="PMModelContainer" StorageEntityContainer="PMModelTargetContainer"></EntityContainerMapping>
I found what was wrong.
One of my foreign key didn't match the primary key (Number 20 instead of Number 10)
I saw on stack overflow that it could be a problem and checked my tables but I missed that one obviously.
How did I realize it ? Well because rather than creating the EF Designer, I chose the Code First from database option, and, oh, what do you know, the error message now tells you EXACTLY what the problem is ! (Table names and columns).

In py2neo, how do I know if a push() worked?

I'm updating a node and pushing it:
remote_graph.push(node)
push() seems to return nothing. How can I tell if the push works? In my test code, I ought to be violating a unique constraint in Neo4J.
How can I tell using py2neo? I expected an exception.
When I enter the equivalent cypher into the Neo4J web tool, I get the following exception:
Node 322184 already exists with label VERSION and property "version"=[1.436818928448956E9]
which is what I expected.
Edit -
What I expected to get back was an indicator of whether the operation worked or not. I think push() accepts an array of nodes, so an array of results would be sensible. I don't know what the indicator would have within it since I don't know what is available. An array of strings would be fine, with each string being a failure reason, or "OK".
Generally speaking, the design of this API is: if it returns OK, you can assume everything has worked as expected, if an error is raised, that error will contain details of what went wrong. Therefore, absence of error should usually be interpreted as a signal of success.
That said, if you believe that your push has failed and no error has been raised, there is a bug in py2neo. For debugging, you can check the state of the database after your push by using the browser and then if you're able to recreate this scenario in a standalone piece of code, please raise an issue on GitHub and I will be happy to fix it.

How do I know which IBM iLog.NET rules are getting hit during execution?

I'm using the IBM iLog.NET business rule engine (v7r1 or thereabouts) and I can't find why my rules are failing. How do I trace down what's failing, where, and why?
I've got a local object model that's calling out to my rules hosted in an IBM rules service on IIS 6.0.
About half of my rules are configured to modify one of the input objects with a new status code. The code isn't getting set when I think it should but I cannot tell conclusively which rules are getting hit.
I found that the IBM iLog.NET documentation had the answer buried deep, deep within. Persistent Google searching revealed that I can set ILOG.Rules.ExecutionServer.Trace.EventFilterCategories on my ExecutionRequest object before I send it to the server.
ExecutionRequest request = new ExecutionRequest(rulePath);
request.TraceFilter.EventFilters
= ILOG.Rules.ExecutionServer.Trace.EventFilterCategories.All;
...
ExecutionResponse response = session.Execute(request);
ILOG.Rules.ExecutionServer.Trace.Trace trace = response.Trace;
Debug.WriteLine(trace.SerializedExecutionTrace);
The serialized trace contains all the inputs and outputs for the call as well as all rules that were triggered during execution and the rules that weren't hit at all.

Issue using executeQueryLocally without server metadata

I'm not using EF, so have followed the NoDb sample to successfully load data from my WebApi without using the server side metadata. After the initial load, I was hoping to use the local data cache in the EntityManager while the user interacts with the page. The problem is when I call executeQueryLocally, the cached data set is empty. I stepped through the code to see why the data wasn't being saved to the cache, and there were two issues:
in _getEntityType, metadataStore.isEmpty() was returning true.
in _getEntityType, metadataStore._getEntityTypeNameForResourceName was returning nothing
To get around the this, I added calls in my code to metadataStore.addDataService and metadataStore._setEntityTypeForResourceName. After adding these, the cache was saved properly and executeQueryLocally worked. I'm assuming this was not the intended way to get this to work... Is there something else I am doing wrong? Or is this a bug that can be fixed?
Sorry for taking so long getting back to this one.
We just made the metadataStore.setEntityTypeForResourceName public in breeze v.1.1.3. ( we renamed the method to remove the first '_".
Otherwise, you did exactly the right thing. Good catch.

Entity Framework Stored Procedure Mapping HELP!

Seems my appreciation for the Entity Framework is taking a serious hit. The "MS almost got it right, but they just missed it because of something L-A-M-E" thought is coming up. Until today everything has been fine. For some unknown reason, it won't compile anymore with Error 2048. I've read up on this and I've seen how you need to map all three operations. Why is this even necessary? What I if I don't need a delete function and only need insert and update? I tried mapping a dummy SP to my delete function. If that fixes my problem, however cheezy, fine. Only problem is, it just created more problems.
Here's what I have. I'm writing a simple newsletter app in MVC. I have entities for a publication, issue and article all generated from my DB (SQL 08). I set up the the relationships in my DB and they translated fine to my EDMX. I made some SPs to insert and update my issues and article. I added them to the EDMX and mapped them accordingly. I don't need a delete function for any of them and I don't need anything for the publication entity. Why is the compiler forcing me to map all functions? IMO, this a MAJOR, MAJOR PROBLEM with EF4 and I can't believe MS would release it with this kind of crap coming up.
The other strange issue is I've tried mapping sp's to entities in another project and configured with only insert and update and they compile fine. Why is the compiler inconsistent?
I would rather not resort to having to use the Imported Functions. Is that my only option? If that's the case it eliminates the ability to the SaveChanges method. Come On MS!!! Fix this!!!!!!!
After much digging and side by side text comparison, I think I have found the solution.
The SP in question was set up like
CREATE PROCEDURE updateArticle
(
#ArticleID INT,
#Content TEXT
)
where it should have been something like
CREATE PROCEDURE updateArticle
(
#ArticleID INT,
#IssueID INT,
#Content TEXT
)
Now, I still don't know why EF4 even requires this since I'm not updating the issueid and the error message lends little help in diagnosing the problem. My SP doesn't even use the IssueID, but EF needs it regardless. Hopefully this will help someone down the road. MS still could do a better job regarding the need for this.

Resources