StreamSocketListener and "An invalid parameter was passed to a function that considers invalid parameters fatal." error - windows-runtime

I have a simplest WinRt c++/cx template project in Visual Studio in which i modified only three lines in MainPage constructor and added simple event handler like this:
MainPage::MainPage()
{
InitializeComponent();
auto listener = ref new Windows::Networking::Sockets::StreamSocketListener;
listener->ConnectionReceived += ref new Windows::Foundation::TypedEventHandler<Windows::Networking::Sockets::StreamSocketListener ^, Windows::Networking::Sockets::StreamSocketListenerConnectionReceivedEventArgs ^>(this, &App3::MainPage::OnConnectionReceived);
Concurrency::create_task(listener->BindEndpointAsync(ref new Windows::Networking::HostName("127.0.0.1"), "6667")).get();
}
void MainPage::OnConnectionReceived(Windows::Networking::Sockets::StreamSocketListener ^sender, Windows::Networking::Sockets::StreamSocketListenerConnectionReceivedEventArgs ^args)
{
throw ref new Platform::NotImplementedException();
}
After running this project i'm getting debugger error like this:
Unhandled exception at 0x0F983C68 (msvcr120d_app.dll) in XXX.exe: An invalid parameter was passed to a function that considers invalid parameters fatal.
This project has enabled "Internet (Client and Server)" and "Private Networks" capabilities.
So my question is: why i'm getting this error? It's a WinRt bug?

Related

Xamarin.Forms Plugin.Geofence giving System.InvalidCastException: Specified cast is not valid

I am using Plugin.Geofence i Implemented its interface,Installed its dependencies i.e. .NETStandard 2.0 and Xamarin.GooglePlayServices.Location.
I am getting this exceptions System.InvalidCastException: Specified cast is not valid. when i run StartMonitoring method.
I am calling this method in the App() Constructor.
public App ()
{
InitializeComponent();
MainPage = new NavigationPage(new MainPage());
CrossGeofence.Current.StartMonitoring(new GeofenceCircularRegion("MyRegion", 31.475085, 74.305833, 200)
{
//To get notified if user stays in region for at least 5 minutes
NotifyOnStay = true,
StayedInThresholdDuration = TimeSpan.FromMinutes(5)
});
}
Tried everything but couldn't resolve this
For anyone looking for a solution to this, ensure that before calling "CrossGeofence.Current" that the correct permissions have been requested and granted. If not, you'll see this error.

Actionscript: TypeError: Error #2007: Parameter Constructor Failed must be non-null

I get the following exception when running my flash app in a browser using the debugging plugin under debian linux. I cannot replicate the exception when I run the app in FlashBuilder (under windows 7) with or without the debugger.
TypeError: Error #2007: Parameter Constructor Failed must be non-null.
at flash.globalization::Collator/ctor()
at flash.globalization::Collator()
at spark.globalization.supportClasses::CollatorBase/http://www.adobe.com/2006/flex/mx/internal::createWorkingInstance()
at spark.globalization.supportClasses::GlobalizationBase/localeChanged()
at spark.globalization.supportClasses::GlobalizationBase/setStyle()
at spark.collections::SortField/get stringCollator()
at spark.collections::SortField/stringCompare()
at spark.collections::Sort/internalCompare()
at Array$/_sort()
at Array/http://adobe.com/AS3/2006/builtin::sort()
at spark.collections::Sort/sort()
at mx.collections::ListCollectionView/internalRefresh()
at mx.collections::ListCollectionView/refresh()
at com.xxx.yyy.model.proxy::RemoteIOProxy/handlePossibleInputs()
at com.xxx.yyy.model.proxy::RemoteIOProxy/handleGetResponse()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at com.xxx.yyy.model.message::ResponseFactory/createResponse()
at com.xxx.yyy.model.proxy::ConnectionProxy/handleData()
I'm not sure what this exception means. It looks like a "Parameter x must be non-null." exception except that would suggest the parameter is named "Constructor Failed" which doesn't really make sense.
I believe that the offending code is in this block someplace, however, I don't know how to make the vm spit out line numbers in stack traces.
// possibleInputs is a populated ArrayCollection
var sort:Sort = new Sort();
var sortField:SortField = new SortField("name");
sort.fields = [sortField];
possibleInputs.sort = sort;
possibleInputs.refresh();

Groovy end exception different from exception thrown

I am running into an extremely strange behavior in Groovy. When I throw an exception from a closure in a Script, the end exception that was thrown was different.
Here are the code and the details:
public class TestDelegate {
def method(Closure closure) {
closure.setResolveStrategy(Closure.DELEGATE_FIRST);
closure.delegate = this;
closure.call();
}
public static void main(String[] args) {
// Make Script from File
File dslFile = new File("src/Script.dsl");
GroovyShell shell = new GroovyShell();
Script dslScript = shell.parse(dslFile);
TestDelegate myDelegate = new TestDelegate();
dslScript.metaClass.methodMissing = {
// will run method(closure)
String name, arguments ->
myDelegate.invokeMethod(name, arguments);
}
dslScript.metaClass.propertyMissing = {
String name ->
println "Will throw error now!"
throw new MyOwnException("errrrror");
}
dslScript.run();
}
}
class MyOwnException extends Exception {
public MyOwnException(String message) {
super(message);
}
}
Script.dsl:
method {
println a;
}
So the plan is that when I run the main() method in TestDelegate, it will run the DSL script, which calls for the method method(). Not finding it in the script, it will invoke methodMissing, which then invokes method() from myDelegate, which in turns invoke the closure, setting the delegate to the testDelegate. So far, so good. Then the closure is supposed to try printing out "a", which is not defined and will thus set off propertyMissing, which will will throw MyOwnException.
When I run the code, however, I get the following output:
Will throw error now!
Exception in thread "main" groovy.lang.MissingPropertyException: No such property: a for class: TestDelegate
Now, it must have reached that catch block, since it printed "Will throw error now!" It must have thrown MyOwnException too! But somewhere along the lines, MyOwnException was converted to MissingPropertyException, and I have no idea why. Does anyone have any idea?
P.S. if I remove closure.setResolveStrategy(Closure.DELEGATE_FIRST) from TestDelegate#method(), the code acts as expected and throws MyOwnException. But I really need the setResolveStrategy(Closure.DELEGATE_FIRST) for my DSL project. And I would prefer to know the root cause of this rather than just removing a line or two and see that it works without understanding why.
I think this is what essentially happens: With a delegate-first resolve strategy, the Groovy runtime first tries to access property a on myDelegate, which results in a MissingPropertyException because no such property exists. Then it tries propertyMissing, which causes a MyOwnException to be thrown. Eventually the runtime gives up and rethrows the first exception encountered (a design decision), which happens to be the MissingPropertyException.
With an owner-first resolve strategy, propertyMissing is consulted first, and hence MyOwnException is eventually rethrown.
Looking at the stack trace and source code underneath should provide more evidence.

My NPAPI plugin gets installed but I cannot call a method from it

I have embeded a simple NPAPI plugin in a Google chrome extension.It gets installed on Google Chrome (it is shown in about:plugins) but the background html page shows "missing plugin" and when a method is called (say plugin.foo), it shows a message saying "the plugin does not have the method foo"
My invoke call looks something like this
static bool
invoke(NPObject* obj, NPIdentifier methodName, const NPVariant *args, uint32_t argCount, NPVariant *result) {
logmsg("invoke");
int error = 1;
char *name = npnfuncs->utf8fromidentifier(methodName);
if(name) {
if(!strcmp(name, "foo")) {
...
....
return invokeDefault(obj, args, argCount, result);
}
}
// aim exception handling
npnfuncs->setexception(obj, "exception during invocation");
return false;
}
https://developer.mozilla.org/en/XEmbed_Extension_for_Mozilla_Plugins
according to this documentation, i have modified my NP_GetValue function and the plugin does not have NPP_SetWindow since i didnt want it to be a windowed plugin.
Am I going wrong somewhere?
Also point out any other places that may have a scope of error.
Thank you
Regards
"Missing plugin" can show either if the plugin isn't loaded (e.g., you typo'd the MIME type in the object tag), or if the plugin crashes during initialization.
Have you tried running with --plugin-startup-dialog to see if your plugin is actually instantiated, and if so debug it?

InvalidCastException: RPC_E_CANTCALLOUT_ININPUTSYNCCALL

I'm building an application in C# that has a static class which initiate a COM class and handles some event handlers of another class that hooks keyboard.
When I call a method of the COM class from a button event handler in my WPF window, the method works without any problems but when I call it in one of the event callbacks within my static class it throws following exception:
Unable to cast COM object of type 'BLAHBLAH' to interface type
'BLAHBLAH'. This operation failed because the QueryInterface call on
the COM component for the interface with IID
'{9DD6680B-3EDC-40DB-A771-E6FE4832E34A}' failed due to the following
error: An outgoing call cannot be made since the application is
dispatching an input-synchronous call. (Exception from HRESULT:
0x8001010D (RPC_E_CANTCALLOUT_ININPUTSYNCCALL)).
Can you please tell me, what this exception means and how can I solve it?
Wrap your code in a new thread:
Thread thread = new Thread(() =>
{
ManagementObjectSearcher theSearcher = new ManagementObjectSearcher("SELECT * FROM Win32_DiskDrive");
foreach (ManagementObject currentObject in theSearcher.Get())
{
Debug.WriteLine("Device present: " + currentObject);
ManagementObject theSerialNumberObjectQuery = new ManagementObject("Win32_PhysicalMedia.Tag='" + currentObject["DeviceID"] + "'");
serial = theSerialNumberObjectQuery["SerialNumber"].ToString();
}
});
thread.Start();
thread.Join(); //wait for the thread to finish
Refer this KB http://support.microsoft.com/kb/198996
Looks like it is because of threads(May not be user defined threads)