IntellitraceFile throwing strange error - c#

Can someone explain this error? (it showed up after enabling tracing in the collection plan.)
Test method ExecuteTaskTest threw exception:
System.ArgumentException: An item with the same key has already been added.
System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
Microsoft.VisualStudio.IntelliTrace.IntelliTraceProcess.AddModule(IntelliTraceModule module)
Microsoft.VisualStudio.IntelliTrace.IntelliTraceProcess.Initialize(IntelliTraceFile traceDebugLogFile)
Microsoft.VisualStudio.IntelliTrace.IntelliTraceProcess..ctor(IntelliTraceFile traceDebugLogFile)
**Microsoft.VisualStudio.IntelliTrace.IntelliTraceFile.get_Processes()**
Microsoft.VisualStudio.Samples.IntelliTraceReader..ctor(String logFileName) in C:\workspace\agileproductlinerdsl\ITraceLogParser\IntelliTraceReader.cs: line 49
UofCASE.AgileProductLinerDSL.Nant.AspenTest.writeTraceResult(FileInfo itraceLog, FileInfo resultFile) in C:\workspace\agileproductlinerdsl\NantTask\AspenTest.cs: line 148
UofCASE.AgileProductLinerDSL.Nant.AspenTest.runTests(FeatureTestMap tests) in C:\workspace\agileproductlinerdsl\NantTask\AspenTest.cs: line 124
UofCASE.AgileProductLinerDSL.Nant.AspenTest.ExecuteTask() in C:\workspace\agileproductlinerdsl\NantTask\AspenTest.cs: line 56
APLDTests.AspenTestTest.ExecuteTaskTest() in C:\workspace\agileproductlinerdsl\APLDTests\AspenTestTest.cs: line 37

It's a known issue with IntelliTrace. The log file was likely collected from an app that had the same module loaded into multiple app domains and this causes IntelliTrace to barf when grabbing the Process list as you can see.

Related

UWP: System.Reflection.TargetInvocationException

This is the error: (it is not complete but this is what VS gives me)
XDG0062 System.Reflection.TargetInvocationException: Exception has
been thrown by the target of an invocation. --->
Windows.UI.Xaml.Markup.XamlParseException: The text associated with
this error code could not be found.
No matching constructor found on type 'SMPlayer.MediaControl'. [Line:
163 Position: 25] at
Windows.UI.Xaml.Application.LoadComponent(Object component, Uri
resourceLocator, ComponentResourceLocation componentResourceLocation)
at SMPlayer.MediaControl.InitializeComponent() at
SMPlayer.M SMPlayer MainPage.xaml 151
However, my MediaControl does have a constructor, which is defined here. (Sorry for posting the link instead of the code). And MediaControl.g.i.cs does not have Line 163.
Nonetheless, my project still compiles and runs correctly even with that error. And my MediaControl is displayed properly.
What is wrong?

Exception thrown inside Exceptional logging

I’m replacing Elmah with Exceptional, but having an issue. It works fine if the exception is thrown inside my web project or if the error is a 404 (The controller for path '/blah/blah' was not found or does not implement IController).
But if I throw an exception from within one of my referenced projects that’s not my web project, then Exceptional throws an error when attempting to log. The following error and stacktrace only gets displayed in the console. The error gets swallowed at that point and doesn't get logged anywhere.
One of the beauties of open-source, is that I can see the code that’s throwing the exception, but no idea why…
Error.cs (line 107, 135, 126)
Exception thrown: 'System.ArgumentException' in Cms.Services.dll
'w3wp.exe' (CLR v4.0.30319: /LM/W3SVC/1/ROOT/wssp-18-131152201224510365): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.Debugger.Runtime\14.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Debugger.Runtime.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
System.NullReferenceException: Object reference not set to an instance of an object.
at System.Web.HttpRequest.CalcDynamicServerVariable(DynamicServerVariable var)
at System.Web.HttpServerVarsCollectionEntry.GetValue(HttpRequest request)
at System.Web.HttpServerVarsCollection.GetServerVar(Object e)
at System.Web.HttpServerVarsCollection.Get(Int32 index)
at System.Web.HttpServerVarsCollection.GetValues(Int32 index)
at System.Collections.Specialized.NameValueCollection.Add(NameValueCollection c)
at StackExchange.Exceptional.Error.<>c__DisplayClass22_0.<SetContextProperties>b__0(Func`2 getter) in C:\BuildAgent\work\d20fce4a5bb47bd3\StackExchange.Exceptional\Error.cs:line 126
at StackExchange.Exceptional.Error.SetContextProperties(HttpContext context) in C:\BuildAgent\work\d20fce4a5bb47bd3\StackExchange.Exceptional\Error.cs:line 135
at StackExchange.Exceptional.Error..ctor(Exception e, HttpContext context, String applicationName) in C:\BuildAgent\work\d20fce4a5bb47bd3\StackExchange.Exceptional\Error.cs:line 107
at StackExchange.Exceptional.ErrorStore.LogException(Exception ex, HttpContext context, Boolean appendFullStackTrace, Boolean rollupPerServer, Dictionary`2 customData, String applicationName) in C:\BuildAgent\work\d20fce4a5bb47bd3\StackExchange.Exceptional\ErrorStore.cs:line 611
I am registering Exceptional like this:
string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["MyApp"].ConnectionString;
ErrorStore.Setup("MyApp", new SQLErrorStore(connectionString));
And this is the only code in my web.config:
<modules runAllManagedModulesForAllRequests="true">
<add name="ErrorStore" type="StackExchange.Exceptional.ExceptionalModule, StackExchange.Exceptional" />
</modules>
I finally found the issue. The code below is what I use to logout a user from my application.
var authenticationManager = HttpContext.GetOwinContext().Authentication;
authenticationManager.SignOut();
authenticationManager.User = new ClaimsPrincipal();
When the 3rd line executes and sets the user to a new ClaimsPrinciple, it removes the following 3 values (AUTH_TYPE, AUTH_USER, REMOTE_USER) and sets them to null inside the System.Web.HttpContext.Current.Request.ServerVariables object, even though the keys are still there inside the object.
So any exception thrown after that line is not logged by Stackexchange.Exceptional, as it tries to read those values and then throws a System.NullReferenceException.

"After parsing a value an unexpected character was encountered" on RavenDB 3.0

I'm running RavenDB 3.0 as a Windows Service on my machine.
There's a collection in the database with 610 documents, and whenever I query it to get them all
_session.Query<StockKeepingUnit>().Take(1024).ToList();
I get the following error:
"After parsing a value an unexpected character was encountered: B. Path 'Results[342].ManufacturerDescription'."
"exceptionType":"Raven.Imports.Newtonsoft.Json.JsonReaderException"
And the following stack trace:
"stackTrace":" at
Raven.Imports.Newtonsoft.Json.JsonTextReader.ParsePostValue() in c:\\Builds\\RavenDB-Stable-3.0\\Imports\\Newtonsoft.Json\\Src\\Newtonsoft.Json\\JsonTextReader.cs:line 762
at Raven.Imports.Newtonsoft.Json.JsonTextReader.ReadInternal() in c:\\Builds\\RavenDB-Stable-3.0\\Imports\\Newtonsoft.Json\\Src\\Newtonsoft.Json\\JsonTextReader.cs:line 392
at Raven.Imports.Newtonsoft.Json.JsonTextReader.Read() in c:\\Builds\\RavenDB-Stable-3.0\\Imports\\Newtonsoft.Json\\Src\\Newtonsoft.Json\\JsonTextReader.cs:line 304
at Raven.Json.Linq.RavenJObject.Load(JsonReader reader) in c:\\Builds\\RavenDB-Stable-3.0\\Raven.Abstractions\\Json\\Linq\\RavenJObject.cs:line 251
at Raven.Json.Linq.RavenJArray.Load(JsonReader reader) in c:\\Builds\\RavenDB-Stable-3.0\\Raven.Abstractions\\Json\\Linq\\RavenJArray.cs:line 139
at Raven.Json.Linq.RavenJObject.Load(JsonReader reader) in c:\\Builds\\RavenDB-Stable-3.0\\Raven.Abstractions\\Json\\Linq\\RavenJObject.cs:line 225
at Raven.Json.Linq.RavenJToken.ReadFrom(JsonReader reader) in c:\\Builds\\RavenDB-Stable-3.0\\Raven.Abstractions\\Json\\Linq\\RavenJToken.cs:line 171
at Raven.Json.Linq.RavenJToken.Load(JsonReader reader) in c:\\Builds\\RavenDB-Stable-3.0\\Raven.Abstractions\\Json\\Linq\\RavenJToken.cs:line 262
at Raven.Json.Linq.RavenJToken.TryLoad(Stream stream) in c:\\Builds\\RavenDB-Stable-3.0\\Raven.Abstractions\\Json\\Linq\\RavenJToken.cs:line 238
at Raven.Client.Connection.HttpJsonRequest.<ReadJsonInternalAsync>d__48.MoveNext() in c:\\Builds\\RavenDB-Stable-3.0\\Raven.Client.Lightweight\\Connection\\Implementation\\HttpJsonRequest.cs:line 459
When I try the same query on the live database, hosted on Azure, the query succeeds.
The local database is a direct import from the one on Azure, so no differences there.
What's interesting is that if I delete the whole database and re-import it, the error remains the the "unexpected character" and the property where it's found change:
"After parsing a value an unexpected character was encountered: v. Path 'Results[342].OriginalRetailPrice'."
I'm at a loss as to where to even begin. Any ideas?

Refrences break console app from running on other machines

I've made a console application which inserts data into a MySql backend, and reads the serial number from a hard disk
To do this i had to add References to MySql.Data and to System.Managment.
The way im running it is by copying the Debug directory from visual studio (i think this is the problem) and running the .exe file on the other machine.
When i run the application on another machine the stack trace error is:
PhDD >C:\Users\User\File\Indexer\WMI\Debug
Your key: 634685018347902535133
Exception getting SMART Object: reference not set to an instance of an object.
Exception in main thread: at System.ThrowHelper.ThrowArgumentOutOfRangeExcept
ion()
at System.Collections.Generic.List`1.get_Item(Int32 index)
at WMITest.Menu.Run() in C:\Users\fps700\Music\WMITest\Menu.cs:line 49
Updated HDD Stats at28/03/2012 18:46:57
Am i correct in thinking this problem is because of the referencing ?
I've checked the methods by recompiling the same code on the other machine and it works, when the references are added through VS.
Can anyone guide me on how to resolve this issue ?
Cheers for reading.
P.S. i tried adding reference paths (by right clicking on the project, selecting options and then choosing Reference Paths and adding the two dll files)
Line 49
bool conversion = int.TryParse(smartData[1].ToString(), out temp);
After adding a fake int value just to make sure conversion isnt the error the new stack trace error is:
PhDD >C:\Users\bborisov\Dropbox\Indexer\WMI\Debug
Your key: 634685018347902535133
Exception getting SMART Object reference not set to an instance of an object.
Exception in main thread: at System.ThrowHelper.ThrowArgumentOutOfRangeExcept
ion()
at System.Collections.Generic.List`1.get_Item(Int32 index)
at WMITest.Menu.Run() in C:\Users\fps700\Music\WMITest\Menu.cs:line 53
Updated HDD Stats at28/03/2012 19:00:24
line 53:
DBHandler.insertData(smartData[0].Trim(),
3, smartData[2], file.getKey());
Put code in to check validity of error situations which may be happening on the client pc but not the development one. You can handle the errors by either throwing an exception or handling it gracefully in a better way.
Here is the code which checks for error situations
if (smartData == null)
throw new Exception("Smart data is null; aborting");
if (smartData.Any() == false)
throw new Exception("Smart data instance is valid but has no elements; aborting");
bool conversion = int.TryParse(smartData[1].ToString(), out temp);

WPF "object reference not set to an instance of an object" on client machine only

I built a WPF application on my m/c and passed on the executable to a client. The application works perfectly well on my machine but throws an error on the client machine. My Logger picked up the following.
Message :Object reference not set to an instance of an object.
Source :App.Feeds
Stack Trace : at App.Feeds.Port
<AdjustWeights>b__1(KeyValuePair`2 item) in
C:\App\1.0.1\App.Feeds\Port\IPort.cs:line 42
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Linq.Enumerable.Sum(IEnumerable`1 source)
at System.Linq.Enumerable.Sum[TSource](IEnumerable`1 source, Func`2 selector)
at App.Feeds.Port.Port.AdjustWeights() in
C:\App\1.0.1\App.Feeds\Port\IPort.cs:line 42
at App.Feeds.Port.Port.BuildPort(String
fileName) in C:\App\1.0.1\App.Feeds\Port\IPort.cs:line 153
The strange thing I noticed is that the logger refers to a path C:\App\1.0.1\App.Feeds\Port\IPort.cs I use on the development machine. Is there something wrong with that?
What could be going wrong?
I'm guessing the Where clause is returning null and when you do a sum on that, it breaks. May be you need to check if the result of the where clause has any items before you do the sum.

Categories

Resources