How to run cosmos application - c#

I have used following code (cosmos + Visual Studio 2008) but on pressing F5 application does not run, rather it provides an error: "microsoft visual studio has encountered an error and need to be close"
using System;
using System.Collections.Generic;
using System.Text;
namespace cosmos.user.kernel
{
public class program
{
public static void Init()
{
Cosmos.Sys.Boot xBoot = new Cosmos.Sys.Boot();
xBoot.Execute();
//Main();
}
static void Main()
{
// Boot the Cosmos kernel:
Cosmos.Compiler.Builder.BuildUI.Run();
//Cosmos.Sys.Boot xBoot = new Cosmos.Sys.Boot();
//xBoot.Execute();
Console.WriteLine("Cosmos booted successfully. Type a line of text to get it echoed back:");
string xResult = Console.ReadLine();
Console.Write("Text typed: ");
Console.WriteLine(xResult);
}
}
}

Since Cosmos is a different operating system, Visual Studio might have issues with trying to debug this thing.
I'd check what Cosmos FAQ and figure out what to do. Browsing the FAQ myself, I see the following disclaimer:
What version of Visual Studio can I
use to develop Cosmos?
Currently we
only support Visual Studio 2008. We
plan to support Visual Studio 2010 in
the future, but right now we have more
important features to complete.
Also, I notice in their Wiki that some folks have had a crashing bug with the VS 2008 integration.

Related

ScriptError: Not authorized to send Apple events to Terminal when running code on Visual Studio 2017 for Mac

Whenever I try to debug some C# code in Visual Studio I keep getting this error code: Debugger operation failed - ScriptError: Not authorized to send Apple events to Terminal.
The project is created as a C# template.
I have tried googling the error message but I have not found anything of value. I have attached screenshots of the code and the error.
using System;
namespace test
{
class MainClass
{
public static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}
Debugger operation failed
ScriptError: Not authorized to send Apple events to Terminal.
Code snippet
Error message
I have the same problem with you when i upgraded to mojave..
according to this link macOS Mojave, Automator “Not authorized to send Apple events to System Events.” you need to checklist terminal in System -> Preferences -> Security & Privacy -> Automation for Visual Studio..
Hope this help..

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.

System.Data.SqLite not working on release mode in visual studio 2017 community edition

I'm developing a windows service which uses System.Data.SQLite (NuGet Package). In Debug mode service is running well but in release mode, after installing the service on windows 10 it didn't work. Here is a snapshot of the error when i tried to start the service
I'm using Visual Studio 2017 Community edition on windows 10 and developing service on .NET 4 framework. I got these from the FAQ at https://system.data.sqlite.org/index.html/doc/trunk/www/faq.wiki#q3. But I'm not sure that I'm this having trouble because of the community edition of visual studio.
Currently, Visual Studio 2005, 2008, 2010, 2012, 2013, and 2015 are
supported, including the "Express" editions; however, in order to
build the entire solution, including the necessary native code, the
"Professional" edition (or higher) is required.
Here is my SQLite Manager class
using System;
using System.Collections.Generic;
using System.Data.SQLite;
using System.IO;
namespace JST3X
{
public class SQLiteDBManager
{
private string dbFullPath;
private string DBConnectionString;
private string DBPassword;
private SQLiteConnection DBConnction;
public SQLiteDBManager(string FullFilePath, string Password = null, Boolean CreateIfNotExist = false)
{
this.dbFullPath = FullFilePath;
if ((!File.Exists(this.dbFullPath)) && CreateIfNotExist)
{
SQLiteConnection.CreateFile(this.dbFullPath);
}
else if (!File.Exists(this.dbFullPath))
{
Console.WriteLine(this.dbFullPath + " not found!");
return;
}
if (Password != null)
{
this.DBPassword = Password;
this.DBConnectionString = "Data source=" + this.dbFullPath + ";Password=" + this.DBPassword;
this.DBConnction = new SQLiteConnection(this.DBConnectionString);
this.DBConnction.SetPassword(this.DBPassword);
}
else
{
this.DBConnectionString = "Data source=" + this.dbFullPath;
this.DBConnction = new SQLiteConnection(this.DBConnectionString);
}
}
}
}
EDIT:
I was trying to access the SQLite database through windows service program and the database was created using windows form application. The WFA was accessing the directory C:\Users\<user>\AppData\Local to store files while service application was accessing directory C:\Windows\SysWOW64\config\systemprofile\AppData\Local to look for files.
I solved (somehow fixed) the problem by storing the directory in environment variables so that both programs will use the same absolute directory. One can post the elegant way of solving this problem.

Visual Studio Selenium Test Starting Local Project

I have a solution with 2 projects.
The static web page project
The selenium tests project
Here's my Test File:
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace SeleniuumTestSuite
{
[TestClass]
public class HomePageTest
{
private string baseURL = "http://localhost:56403/";
private static IWebDriver driver;
[AssemblyInitialize]
public static void SetUp(TestContext context)
{
driver = new ChromeDriver();
}
[TestMethod]
public void RemoteSelenium()
{
driver.Manage().Window.Maximize();
driver.Navigate().GoToUrl(this.baseURL);
}
[TestCleanup]
public void Finally()
{
driver.Quit();
}
}
}
I need to start the localhost project before the test case runs so that navigating to the localhost doesn't result in a 404. I found this post that seems to answer that question but I have no idea what library the solution is using.
I tried using NuGet to download Microsoft.AspNet.WebApi.WebHost but if I try to do private Server _webServer = new Server(Port, VirtualPath, SourcePath.FullName);, VS doesn't recognize Server and has no idea what library to import. So I'm kind of stuck here.
Any idea how to get this to work?
In order to solve the problem, it is necessary to run the two projects at the same time, as mrfreester pointed out in comments:
The main project in order to be able to run the main application.
The test project which will access the running main application to test it.
As mrfreester suggested, you might use two visual studio instances and it will work. Yet, to enhance this solution and manage everything in just one visual studio instance, you can run the main project using Debug.StartWithoutDebugging (default keyboard shortcut is ctrl + f5). This will effectively run the server for the application without starting VS debug mode, allowing you (and your test project) to normally use the application. The application will run even if you close your browser.
Be noted: if you start your application debugging normally, when you stop the execution, the server will stop, and you will have to start again without debugging to be able to pass your tests again.

ConfigurationErrorException when debugging on Visual Studio 2010, .Net Framework 4, 32-bit

I've run across an issue when debugging applications on VS 2010.
This is a simple command-line app:
namespace HttpTest
{
class Program
{
public void testHTTP ()
{
Console.WriteLine("Creating HTTP request. Press a key to proceed.");
Console.ReadKey();
var request = (HttpWebRequest)HttpWebRequest.Create("http://stackoverflow.com");
Console.WriteLine("Getting response...");
var response = (HttpWebResponse)request.GetResponse();
Console.WriteLine("Done");
Console.ReadKey();
}
static void Main(string[] args)
{
Program app = new Program();
app.testHTTP();
}
}
}
If I launch/debug it from Visual Studio 2010, I get a ConfigurationErrorsException when creating the HttpWebRequest:
Error creating the Web Proxy specified in the 'system.net/defaultProxy' configuration section.
This is quite suprising, as my app.config has no entry in system.net/defaultProxy (and neither does my devenv.exe.config).
By trying different settings, I found out that the error only happens if I set the target framework to 4.0 and the target platform to x86 and try to debug within VS
If I build it and run it from the command line (regardless of build settings), I have no issues.
If I set the target Framework to 3.5, the error disappears and the app debugs normally.
If I set the platform target to 'x64' or 'Any CPU', the app debugs normally.
If I build on 4.0/x86, run from command line, attach the debugger while waiting for the first key press, then proceed, I get the error mentioned above.
I have disabled the firewall on my machine
Running VS as administrator makes no difference to the test.
If I try this on a different machine, same hardware specs and OS, belonging to a colleague, I can debug it within VS2010.
It obviously has something to do with the settings on my machine. However, I have been unable to isolate what the conditions are.
Other users suggested moving the application to the C: drive. I don't think this applies to my case, as I can run int successfully from the D: drive. Issue happens only when debugging within VS.

Categories

Resources