I am trying to generate/run some report by querying work items from TFS using C#.
Referred this link. This code worked fine couple of months back and was able to retrieve the results.
Not sure why am getting below exception at Line 2
var tfsUrl = ConfigurationManager.AppSettings.Get("TfsCollection");
var uri = new Uri(tfsUrl);
var projCollection = TfsTeamProjectCollectionFactory
.GetTeamProjectCollection(uri);
//var workItemStore = projCollection.GetService<WorkItemStore>(); //Line 1
var workItemStore = new WorkItemStore(projCollection); //Line 2
Tried other ways of querying work items like Line 1, but no luck. Any help here would be highly appreciated. Also, is there any better way of querying TFS using C#?
Exception details:
A first chance exception of type 'System.ArgumentNullException' occurred in mscorlib.dll
Additional information: Value cannot be null.
System.ArgumentNullException occurred
_HResult=-2147467261
_message=Value cannot be null.
HResult=-2147467261
IsTransient=false
Message=Value cannot be null.
Parameter name: value
Source=mscorlib
ParamName=value
StackTrace:
at System.Enum.TryParseEnum(Type enumType, String value, Boolean ignoreCase, EnumResult& parseResult)
InnerException:
My bad. Enabled this option in VS.
Debug -> Exceptions -> CLR exceptions
Code will execute despite of the exception.
Related
I am collecting Resultant Set of Policies using the Group Policy Management dll. There exist a class GPRSop, which I use, with the attributes RsopMode and WMI Namspace as a string:
GPRsop test = new GPRsop(RsopMode.Logging, "Root/RSOP");
test.LoggingMode = LoggingMode.Computer;
test.LoggingComputer = "MyComputer";
test.LoggingUser = "domain\\user";
test.CreateQueryResults();
test.GenerateReportToFile(ReportType.Xml, "C:\\Temp\\test.xml");
LoggingMode, LoggingComputer and LoggingUser all throw the same exception:
System.ArgumentException: 'Value does not fall within the expected range.'
If I set the wmiNamespace " " as recommended, it also throws an exception.
I had to run Visual Studio as an administrator. After that I did not even need to provide a wmiNamespace.
Thanks for your help
TextWriter textWriter = new StreamWriter(#System.Environment.GetEnvironmentVariable("OUTPUT_PATH"), true);
when I run this, I am getting the following error.
Exception thrown: 'System.ArgumentNullException' in mscorlib.dll An unhandled exception of type 'System.ArgumentNullException' occurred in mscorlib.dll Value cannot be null.
How to fix it?
Environment Variable OUTPUT_PATH is not set.
System.Environment.GetEnvironmentVariable("OUTPUT_PATH")
This statement is returning null.
Please check environment variables to confirm if path is correctly set or not.
If path is there, then there may be access privilege issue. Your code may not have permissions to read the environment variable.
Hi I'm taking back the lead on a project for an Excel plugin. But I ran into a kind of strange error:
System.Runtime.InteropServices.COMException (0x800A03EC): Parameter not valid at Microsoft.Office.Interop.Excel._Chart.FullSeriesCollection(Object Index)
The corresponding line is:
chart.FullSeriesCollection(1).DataLabels.ShowValue = true;
Any idea of what's wrong in there?
I'm trying to configure Postal in class library project. To do this I need to configure custom EmailService. On Postal webpage there's a snippet for doing this:
// Get the path to the directory containing views
var viewsPath = Path.GetFullPath(#"..\..\Views");
var engines = new ViewEngineCollection();
engines.Add(new FileSystemRazorViewEngine(viewsPath));
var service = new EmailService(engines);
(See here: http://aboutcode.net/postal/outside-aspnet.html)
Surprisingly, following error is thrown:
System.ArrayTypeMismatchException occurred HResult=-2146233085
Message=Attempted to access an element as a type incompatible with the
array. Source=mscorlib StackTrace:
at System.Collections.Generic.List`1.Insert(Int32 index, T item) InnerException:
To be precise - it's thrown during adding FileSystemRazorViewEngine to ViewEngineCollection. FileSystemRazorViewEngine derives from IViewEngine and ViewEngineCollection derives from Collection<IViewEngine>.
And here's stacktrace:
mscorlib.dll!System.Collections.Generic.List.Insert(int
index, System.__Canon item) + 0x3e bytes
System.Web.Mvc.dll!System.Web.Mvc.ViewEngineCollection.InsertItem(int
index, System.Web.Mvc.IViewEngine item) + 0x89 bytes
I can't figure out what causes the exception.
I am getting same error. I suspect that Postal is built with slightly different version of System.Web.Mvc that the main project that causing ViewEngine incompatibility... But I only have production binaries of the postal...
I am hoping that someone who has worked with ArangoDB and .Net and C# can help me out.
When I call ArangoClient.AddConnection() an exception gets thrown (of type 'System.ArgumentException' occurred in mscorlib.dll). The message is "An item with the same key has already been added."
The call to ArangoClient is: ArangoClient.AddConnection("127.0.0.1", 8529, false, "NancyTest", "NancyTest", "root");
Any ideas?
You most probably already created a connection with specified alias. With a driver version 0.9.0 and higher you can check if the specified alias already exists through ASettings.HasConnection(string alias) static method.