Why this Error is Coming while running the application? - c#

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.

Related

ML.NET: strange runtime error on some machines

I wrote a simple UWP app using the ML.NET framework, and it worked on one of my machines without installing any Nuget packages, without any additional setup etc.
However, on my other machine, after running the application, I get this error:
System.Runtime.InteropServices.COMException: 'Unspecified error
No suitable kernel definition found for op Sub (node Minus675)'
The error happens in this segment of code:
public static async Task<modelModel> CreateFromStreamAsync(IRandomAccessStreamReference stream)
{
modelModel learningModel = new modelModel();
learningModel.model = await LearningModel.LoadFromStreamAsync(stream);
learningModel.session = new LearningModelSession(learningModel.model); // it breaks here
learningModel.binding = new LearningModelBinding(learningModel.session);
return learningModel;
}
In case anyone should ask - yes I have added my .onnx model in the Assets folder. My configuration is: VS 2017, Windows 10 version 1809, build 17763.194, and I have Windows 10 SDK version 10.0.17763.132. I have tried installing the Visual Studio Tools for AI and ML.NET Templates VS extensions, but it didn't help.

Sharepoint 2010 - PickerEntity method not found

I created form as webpart for Sharepoint Foundation 2010 with custom PickerEntity (used for pick IDs from MS SQL).
When I deployed webpart to development environment (through right-click on project -> deploy), everything worked fine.
When I deployed this webpart as .wsp Package to test or production environment (Release build config), I got error when in form in PickerEntity was saved wrong (non-exist) ID.
Error:
Message: System.MissingMethodException: Method not found: 'Microsoft.SharePoint.WebControls.PickerEntity[] Microsoft.SharePoint.WebControls.EntityEditor.ResolveErrorBySearch(System.String)'.
It should write error message on form "No exact match was found. Click the item(s) that did not resolve for more options.", but in runs to this error and fails to load rest of the form.
Class with method:
public class VendorEditor : EntityEditorWithPicker
{
.....
protected override PickerEntity[] ResolveErrorBySearch(string unresolvedText)
{
return base.ResolveErrorBySearch(unresolvedText);
}
.....
}
The error is "method not found"
What may be happening is:
It cannot find the method because it cannot find the dll
It cannot find the dll since a feature is not turned on
Check what is activated on your development machine compared with what is activated in production.

"An error has occured in the script on this page" when opening a webpage in my C# program

I am opening up a website www.odds.com.au from within my C# program (wirtten using Microsoft Visual Studio 2008 Version 9.0.21022.8 RTM, Microsoft .NET FrameworkVersion 3.5 SP1) and the following error appears when the website opens:
An error has occured in the script on this page
Line: 221
Char: 3
Error: Object doesn't support this property or method
Code: 0
URL: http://www.odds.com.au/javascripts/odds.js?1320019370
Do you want to continue running scripts on this page?
My xaml.cs code is:
private void NavigateToUrl(string Url)
{
wbMain.Navigate(new Uri("http://www.odds.com.au", UriKind.RelativeOrAbsolute));
}
I have searched the internet and cannot find a definite answer. If anyone could help that would be appreciated.
Thanks
I think the error is inside javascript http://www.odds.com.au/javascripts/odds.js?1320019370. It has nothing to do with your code. However I do not see this error when view the same page with Chrome. You may want to disable script errors:
wbMain.ScriptErrorsSuppressed = true;
If you parse your JavaScript with a popular lint utility, you will see multiple warnings. One or more of these issues may be triggering the script error that you're seeing.
In addition, the Chrome JavaScript console reports that eventLayer.X and eventLayer.Y are broken and deprecated in WebKit.
Disable the script error message
webBrowser1.ScriptErrorsSuppressed = true;

C# & Windows Update Api (WUApiLib)

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.

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