ArgumentException on MediaElement AreTransportControlsEnabled property set (Windows Phone 8.1) - c#

I am developing Windows Phone application and I got a really weird exception when I set my MediaElement object property AreTransportControlsEnabled to some value:
_mediaElement.IsFullWindow = fullScreen;
_mediaElement.AreTransportControlsEnabled = fullScreen;
This is what that I get:
Exception thrown: 'System.ArgumentException' in MyApp.ni.EXE WinRT
information: The value cannot be infinite or Not a Number (NaN).
Additional information: The parameter is incorrect.
The value cannot be infinite or Not a Number (NaN).
How boolean value can be a NAN or in finite and why it's allways throws the exception on the AreTransportControlsEnabled boolean property and not on IsFullWindow?
This issue is still hunting me...2 months gone now...

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?

Getting first chance exception while querying work items from tfs

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.

Error while drawing shape on Canvas Windows 10 Universal Apps

I am creating an app that draws shapes on canvas and those shapes are recognized as letters using https://github.com/phatware/WritePadSDK sdk for writing pad. but the problem is that this api code works fine when it is used in windows 8.1 project but when the same code is used in windows 10 universal app it produces error when i debugged the code. Code of xaml is given bellow
<Canvas Background="WhiteSmoke" Name="InkCanvas" PointerPressed="OnCanvasPointerPressed" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" PointerReleased="OnCanvasPointerReleased" PointerCaptureLost="OnCanvasPointerCaptureLost" PointerExited="InkCanvas_OnPointerExited" PointerMoved="OnCanvasPointerMoved" LostFocus="InkCanvas_LostFocus">
and the code which is recognizes the shape using sdk is given bellow which is executed on PointerReleased event of Canvas:-
var resultValue = recognizerShared.RecognizeStrokes(InkCanvas.Children.ToList(), false);
and when i inspected the method given in sdk i.e. RecognizeStrokes which does the recolonization i got error when i did debugging
As this code works fine in windows 8.1 project i think it can be something todo with windows 10 universal app problem
Excelption details is given bellow:-
AccessKey = 'new System.Collections.Generic.Mscorlib_CollectionDebugView<Windows.UI.Xaml.UIElement>(strokes).Items[0].AccessKey' threw an exception of type 'System.InvalidCastException'
AccessKeyScopeOwner = 'new System.Collections.Generic.Mscorlib_CollectionDebugView(strokes).Items[0].AccessKeyScopeOwner' threw an exception of type 'System.InvalidCastException'
AllowFocusOnInteraction = '((Windows.UI.Xaml.FrameworkElement)new System.Collections.Generic.Mscorlib_CollectionDebugView(strokes).Items[0]).AllowFocusOnInteraction' threw an exception of type 'System.InvalidCastException'
AllowFocusWhenDisabled = '((Windows.UI.Xaml.FrameworkElement)new System.Collections.Generic.Mscorlib_CollectionDebugView(strokes).Items[0]).AllowFocusWhenDisabled' threw an exception of type 'System.InvalidCastException'
ContextFlyout = 'new System.Collections.Generic.Mscorlib_CollectionDebugView(strokes).Items[0].ContextFlyout' threw an exception of type 'System.InvalidCastException'
ExitDisplayModeOnAccessKeyInvoked = 'new System.Collections.Generic.Mscorlib_CollectionDebugView(strokes).Items[0].ExitDisplayModeOnAccessKeyInvoked' threw an exception of type 'System.InvalidCastException'
FocusVisualMargin = '((Windows.UI.Xaml.FrameworkElement)new System.Collections.Generic.Mscorlib_CollectionDebugView(strokes).Items[0]).FocusVisualMargin' threw an exception of type 'System.InvalidCastException'
FocusVisualPrimaryBrush = '((Windows.UI.Xaml.FrameworkElement)new System.Collections.Generic.Mscorlib_CollectionDebugView(strokes).Items[0]).FocusVisualPrimaryBrush' threw an exception of type 'System.InvalidCastException'
new System.Collections.Generic.Mscorlib_CollectionDebugView(strokes).Items[0].IsAccessKeyScope
Please help me to solve the problem above.
Link to download the sample project code is given bellow for testing where you can see the problem
https://www.dropbox.com/s/1xbtxbxwyoyuf00/WindowsSDK.rar?dl=0
Thanks!

Throw Exception when set OutlineCode1 value on Export Data to Microsoft Office Project

I developed a Windows Forms Application with C# and SQL Server, I wrote this code to set OutlineCode1 value :
using Microsoft.Office.Interop.MSProject;
...
task.OutlineCode1 = value.ToString();
when i set task.OutlineCode1 value, throw exception and i get this Error :
System.Runtime.InteropServices.COMException
"An unexpected error occurred with the method."
i tested all Microsoft Office Project interop version.
The OutlineCode1-10 fields are limited to values on the lookup list. First populate the list, then you can set the values.
You can do this from the user interface or at runtime:
CustomFieldValueListAdd pjCustomTaskOutlineCode1, value.ToString()
(add object qualifiers as necessary)

ILNumerics.Misc.ILThreadPool' threw an exception when ILNumerics.Settings.UseThreadAffinity is not manually set to false

Sometimes when I use ILMath functions such as ILMath.linspace and others, the following exception is thrown without obvious reason.
System.TypeInitializationException was unhandled by user code
HResult=-2146233036
Message=The type initializer for 'ILNumerics.Misc.ILThreadPool' threw an exception.
Source=ILNumerics
TypeName=ILNumerics.Misc.ILThreadPool
StackTrace:
at ILNumerics.Misc.ILThreadPool.Wait4Workers(Int32& workerCount)
at ILNumerics.ILMath.multiplyElem(ILInArray`1 A, ILInArray`1 B)
at ILNumerics.ILDenseArray`1.op_Multiply(ILDenseArray`1 A, ILDenseArray`1 B)
at ILNumerics.ILMath.linspace[T](ILBaseArray start, ILBaseArray end, ILBaseArray length)
at ILNumerics.ILMath.linspace(ILBaseArray start, ILBaseArray end, ILBaseArray length)
at *** in ***\Numerics\NumericsTest.cs:line 104
at *** in ***\Numerics\NumericsTest.cs:line 94
InnerException: System.ComponentModel.Win32Exception
HResult=-2147467259
Message=The parameter is incorrect
Source=System
ErrorCode=-2147467259
NativeErrorCode=87
StackTrace:
at System.Diagnostics.ProcessThread.set_ProcessorAffinity(IntPtr value)
at ILNumerics.Misc.ILThreadPool..ctor(Int32 maxThreads)
at ILNumerics.Misc.ILThreadPool..cctor()
InnerException:
By trial and error, I realized that if I set ILNumerics.Settings.UseThreadAffinity = false,
The code then executes without error. I read from ILNumerics documentation that UseThreadAffinity should default to false, which in my case it is definitely set to true by default. Is this a bug? Another problem I notice that the documentation also mentions I can use App.config to change default settings, I tried that and the ILNIsHosted actually does what it says, but ILNUseThreadAffinity has no effect at all on the UseThreadAffinity setting. It is still “true” even though I tried set it to false. Is this a bug of ILNumerics? I’m using ILNumerics 3.2.2.0 (any CPU)obtained from NuGet directly. The code is running in VS2010 on Windows 7 64bit.
<appSettings>
<add key="ILNIsHosted" value="true" />
<add key="ILNUseThreadAffinity" value="false"/>
</appSettings>
To add on to the original question, I went to download the source code of ILNumerics community edition and discovered something strange.
ILSettings.cs contains the following:
public static bool UseThreadAffinity {
get { return s_isHosted; }
set { s_isHosted = value; }
}
These lines don't make sense to me. Why is UseThreadAffinity set to s_isHosted. I think this may be why when I set ILNIsHosted to true, the thread affinity changed to true as well.

Categories

Resources