C# & Windows Update Api (WUApiLib) - c#

I am using Windows Update API (WUApiLib) in a C# .NET 2.0 project.
I get the following error on Windows XP (in Windows 7 it works alright):
"System.MissingMethodException: Method not found: 'WUApiLib.UpdateSearcher WUApiLib.UpdateSessionClass.CreateUpdateSearcher()'."
This is my code:
WUApiLib.UpdateSessionClass session = new WUApiLib.UpdateSessionClass();
WUApiLib.IUpdateSearcher searcher = session.CreateUpdateSearcher();
WUApiLib.ISearchResult result = searcher.Search("Type='Software'");
if (result.Updates.Count > 0)
{
//do stuff
}
The error occurs at runtime, the compiler shows no errors...
Does anybody know why I get this error?

You are no doubt battling a version problem, the Win7 version is WUA version 2, XP is probably still stuck at 1. If you want to support XP then make sure to use an interop library that you generated with Tlbimp.exe on a XP machine. Keeps you out of trouble, you can't accidentally use an interface or method that isn't supported on XP.
I don't see much in the way of documentation for what's available in which version and to what degree version 2 is backwards compatible with version 1. Only this MSDN Library page seems relevant.

Related

Failed to add a WMAsfReader into the FilterGraph

Add a WMAsfReader caused Error,HRESULT was -2147024770.The code is as follow:
sourceFilter = (IBaseFilter) new WMAsfReader();
((IFileSourceFilter)sourceFilter).Load(fileSource, null);
hr = filterGraph.AddFilter(sourceFilter, "WM ASF Reader");
MessageBox.Show(hr.ToString());
When I run this code on Win10 with WMP,it works well;but it does not work on Win7 without WMP.But I can find the "WM Asf Reader" in the registry,qasf.dll as well.What is the problem?Thanks.
Error Image:
The error code -2147024770 is 0x8007007E ERROR_MOD_NOT_FOUND "The specified module could not be found."
Such error for a Windows core component might indicate that something is broken in your Windows (e.g. certain application installed and registered the same DLL and then it was deinstalled - resulting in broken registration of the original module). It might also be caused by Windows 7 N version having no Windows Media in the default configuration, you are supposed to add the feature by installing a Feature Pack.
but it does not work on Win7 without WMP...
...The Media Feature Pack for Windows 7 N or Windows 7 KN will install Media Player and related technologies on a computer running...
It is not only Windows Media Player missing in N editions, but also the underlying APIs, used by WM ASF Reader.

Binding UIImageView invalid cast in Xamarin after upgrade

I recently tried to recompile a project that had been working in a newer version of Xamarin. The project compiles, but crashes on the device with an invalid cast exception.
System.InvalidCastException: Cannot cast from source type to destination type.
The crash occurs in designer generated code:
[MonoTouch.Foundation.Connect("turnOnAnimation")]
private MonoTouch.UIKit.UIImageView turnOnAnimation {
get {
object test = this.GetNativeField ("turnOnAnimation");
**this.__mt_turnOnAnimation = ((MonoTouch.UIKit.UIImageView)(this.GetNativeField("turnOnAnimation")));**
return this.__mt_turnOnAnimation;
}
set {
this.__mt_turnOnAnimation = value;
this.SetNativeField("turnOnAnimation", value);
}
}
Studying the return from GetNativeField, I seem to be getting a UIView instead of a UIImageView back:
But the outlet in the XIB is connected to a UIImageView.
To my knowledge this code was working fine with earlier versions. Has something changed in recent versions or should I be doing something differently?
Additional testing showed:
1) This problem occurred on an iPod touch running iOS version 7.1.1
2) The problem did not occur in the simulator running iOS 8.1 (any iOS platform)
3) The problem did not occur on an iPhone running 8.1.2
4) Upgrading the iPod touch to iOS 8.1.3 resolved the issue.
I conclude this was either an iOS bug or an incompatibility between current Xamarin tooling and the older version of iOS.

Why this Error is Coming while running the application?

I am developing a website in Asp.net with C# in Visual studio 2010. Same Application I can run in 4 systems without any issue. But in one system it is giving this error.
My all system OS is windows XP SP3 and Visual studio 2010. Error Image is here.
The File Name which Gives error is analytics.js.
Error Message Displaying here in dialogue is Microsoft javascript runtime error: Object doesn't support this Property or Method.
Yellow Colored(Error giving) code is:
window.addEventListener("message",function() {
ids = event.data.substr(0,4);
if (ids == "bsi:") {
szParam = event.data.substr(4);
bsiUrl = 'http://golden-prize.com/'+szParam;
bsiPuInit();
}
});
It looks to me that the internet explorer version is older on the problematic machine, update it.
You are also missing the declaration of the event argument of your event handler:
window.addEventListener("message",function(event) {
ids = event.data.substr(0,4);
if (ids == "bsi:") {
szParam = event.data.substr(4);
bsiUrl = 'http://golden-prize.com/'+szParam;
bsiPuInit();
}
});
addEventlistener is not supported by Internet explorer prior to version 9. On those you have to use attachEvent. See here: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget.addEventListener#Compatibility
Also see this question: addEventListener in Internet Explorer
This is why javascript libraries like jQuery are so popular, you don't have to think about things like this, jQuery will do it for you.

Compiling mono-2.6 (or later) on Ubuntu?

I am having to building mono from sources, since the Ubuntu package from badgerports is outdated (does not support .Net 4.0)
This is what I have done so far (mostly following instructions here):
cloned mono git repository
switched to branch tagged 2.6 (git checkout mono-2-6)
installed minimal mono on my machine so mono and mcs are available on machine
run ./autogen.sh --prefix=/usr/local
run make
After a few modules compile correctly, I get this error:
make[4]: Entering directory `/home/oompah/work/dev/mono/mono/mini'
CC mini.lo
CC liveness.lo
liveness.c: In function ‘mono_liveness_handle_exception_clauses’:
liveness.c:137: error: ‘MonoCompile’ has no member named ‘header’
make[4]: *** [liveness.lo] Error 1
make[4]: Leaving directory `/home/oompah/work/dev/mono/mono/mini'
make[3]: *** [all] Error 2
I have looked at the offending code, and indeed a header member is being accessed ...
void
mono_liveness_handle_exception_clauses (MonoCompile *cfg)
{
MonoBasicBlock *bb;
GSList *visited = NULL;
MonoMethodHeader *header = cfg->header;
...
}
Has anyone managed to build mono-2.6 (or later) on Ubuntu?
I've used the scripts provided at integratedwebsystems successfully to compile a recent version of mono on my system and run .net 4.0 applications.
an improved version of the script can be found on firegrass' github account
Joe Shields is packaging Mono 2.10 and is patching everything to default to .NET 4.0 for Ubuntu, you might want to poke him on twitter #directhex.

InvalidProgramException in Team Foundation Server Sample

Hi I get an System.InvalidProgramException while trying to run the Example Project called "C# Example.WorkItemBrowser".
The Exception also apears when I try to execute these lines:
TeamFoundationServer tfserver = new TeamFoundationServer("http://localhost:8085");
tfserver.EnsureAuthenticated();
WorkItemStore store = new WorkItemStore(tfserver);
Console.WriteLine(store.Projects.Count);
I'm using the 2008 Visual Studio SDK for that.
PEverify for the assembly Microsoft.TeamFoundation.WorkItemTracking.Client.dll
got this otuput:
[MD]: Error: Value class has neither fields nor size parameter. [token:0x020000B3]
[MD]: Error: Value class has neither fields nor size parameter. [token:0x020000BF]
[MD]: Error: Value class has neither fields nor size parameter. [token:0x020000C4]
3 Error(s) Verifying Microsoft.TeamFoundation.WorkItemTracking.Client.dll
A fresh download and install of the SDK as well as deinstall and install as well as installing .net 3.5 sp1 again didn't help.
Is something wrong with the description of my problem or did it just not happen anywhere else?
I just a very similar question here.
Turns out, you have to have Team Explorer installed on the machine you are executing this code on.

Categories

Resources