MonoDevelop debugging error - mono

I've recently changed to Ubuntu 11.10 (from Windows Vista).I use mono (2.8.5) as my IDE (C# VS.net before) to program.
As a quick test I want to make a console program with the following code:
using System;
namespace DeleteMe1
{
class MainClass
{
public static void Main (string[] args)
{
Console.WriteLine ("Hello World!");
Console.ReadKey ();
}
}
}
If I run the program I see a screen appear and disappear (very quickly). When I debug I get the following error:
Could not open port for debugger. Another process may be using the port.
Is someone familiar with these messages? I've already tried the following:
https://stackoverflow.com/questions/8...using-the-port
But the property key (Property key="MonoTouch.Debugger.Port" value="10000") is not available.
Whats wrong?
Thanks in advance and with best regards.

Related

VS2022 - Hot reload applying changes successfully but not reflecting in app for a simple console app

I have a simple .net 6.0 console with the following code running on visual studio 2022. I change the Console.WriteLine text while the app is running and I get a log message from hot reload saying "Changes were successfully applied.". But nothing happens on my app. What am I doing wrong? I tried with and without debugger as per suggestions on other stack overflow threads. But no luck it still does not work. Here's my code.
using System;
namespace TestVS2022
{
public static class Program
{
public static void Main(string[] args)
{
while (true)
{
System.Console.WriteLine($"Hello World.");
Thread.Sleep(1000);
}
}
}
}

"mono app.exe" gives error "File does not contain a valid CIL image."

I've made the following as a simple test.
using System;
namespace test
{
class App
{
static void Main(string[] args)
{
Console.WriteLine("test");
Console.ReadLine();
}
}
}
Then compiled and moved the entire bin folder to my pi and tried to run it using "mono app.exe" but I get the error in the title. How do I run compiled .Net core executables using mono on raspberry pi?
Realized that mono is .NET framework.
I installed .NET core runtime and it worked.
I followed this guide

NUnit3-Console.exe on Win Server 2012 has no TestFixtures

I have been running NUnit3-Console on Win 2012 for almost two years. I recently updated my tests to .Net 4.7.2 and updated the NUnit and Selenium to the latest versions. I have installed NUnit3-Console v3.8 on the server and .Net 4.7.2.
All of the tests that used to run fine now fail with the message "Has no TestFixtures.
I wrote a simple test to isolate the issue and it does the same thing.
My Base class
enter code here
using NUnit.Framework;
using Utilities;
namespace CommonCode2.TestBases
{
public class NoSeleniumBase
{
public Parameters parms = new Parameters();
[OneTimeSetUp]
public void InitializePageTests()
{
parms.GetParameters();
}
[OneTimeTearDown]
public void CleanupPageTests()
{
}
}
}
My SimpleTest
enter code here
using CommonCode2.TestBases;
using NUnit.Framework;
using System;
namespace SimpleTest
{
[TestFixture]
public class TestClass : NoSeleniumBase
{
[Test]
public void Atest()
{
Console.WriteLine("This is a simple test");
}
}
}
The NUnit files are installed in C:\NUnit and the test is invoked using.
C:\Nunit\NUnit3-Console.exe --where "name =~ 'Atest'"
"C:\QA_Libraries3\SimpleTest.dll"
The TestResult file contains this tag
<property name="_SKIPREASON" value="Has no TestFixtures" />
and a message block
<![CDATA[Has no TestFixtures]]></message>
I am hoping that someone has encountered this issue and can point me in the right direction.
Thanks to Charlie Poole and Rob Prouse for their responsive and helpful support. The issue was not with NUnit3-Console but with the tests library directory access. Deleting and recreating the directory resolved the issue.

Unit Testing from within Play-Module (JPA, eclipse PersistenceProvider)

My application is based on playframework and contains multiple modules.
The database interaction is handled trough JPA (<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>)
My task is to cover one of these modules with unit-tests.
Unfortunately running the "play test" command with unit tests provied on module-level results in the following Exception:
javax.persistence.PersistenceException: No Persistence provider for EntityManager named defaultPersistenceUnit
Persistence-Provider is defined globaly (outside of the Module) in conf/META-INF/persistence.xml
copying the global persistence.xml to the module doesn't fix the issue.
Placing the tests outside of the module (in global test directory) and execute them works flawless presuming that there are no other tests within modules.
Can someone explain me why the Error comes up? Is there any way to have working JPA-capable tests on module level?
Thanks in advance
Urs
I had the same problem running JUnit tests from my play application in Eclipse.
To solve this issue you need to make the folder conf available to the all project.
Project Properties-> Java Build Path ->Source
Add Folder and choose the conf folder.
I checked your code. I think don't need another persistence.xml. Can you try these solutions in play module:
#Test()
public void empty() {
running(fakeApplication(), new Runnable() {
public void run() {
JPA.withTransaction(new play.libs.F.Callback0() {
public void invoke() {
Object o = new Object(someAttrib);
o.save();
assertThat(o).isNotNull();
}
});
}
});
}
Or:
#Before
public void setUpIntegrationTest() {
FakeApplication app = fakeApplication();
start(app);
em = app.getWrappedApplication().plugin(JPAPlugin.class).get().em("default");
JPA.bindForCurrentThread(em);
}
These codes are from this page. I don't test it!
Please modify your code to:
#BeforeClass
public static void setUp() {
FakeApplication app = fakeApplication(inMemoryDatabase());
start(app);
em = app.getWrappedApplication().plugin(JPAPlugin.class).get().em("default");
JPA.bindForCurrentThread(em);
}
Please try it!

Single process C#.Net windows service is showing multiple thread in CPU resource monitor?

I have developed a C#.Net windows service which is a single process.In this I'm using 2 third party Dlls one for ZIP(Ionic) and another for Excel(EPPlus).
The .EXE job is to:
Read SDF file
Write the SDF file data to SQL Server table
Generate Excel
Create ZIP
While monitoring this particular EXE in resource monitor it is showing 10 threads are running.
Note: I have not used any threading in this application.
Is OS making it 10 threads? If yes, how and why??
Related: Why does this simple .NET console app have so many threads?
I'll use a simple console application in Visual Studio 2010 that adds a reference to an assembly that spawns a thread similar to what a 3rd party library could do.
A Windows Service may have different debugging techniques, and may have various additional threads running created by the system.
Simple Console
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
ClassLibrary1.Class1.StartThread();
while (true)
{
System.Threading.Thread.Sleep(1000);
System.Diagnostics.Trace.TraceInformation("test2");
}
}
}
}
Simple API in separate class library assembly, added as a reference to the Console project
using System.Threading.Tasks;
namespace ClassLibrary1
{
public class Class1
{
public static void StartThread()
{
var t = new Task(() => {
while(true)
{
System.Threading.Thread.Sleep(1000);
System.Diagnostics.Trace.TraceInformation("test1");
}
});
t.Start();
}
}
}
Start Debugging (F5)
From the Menu Debug, Select 'Break All'
From the Menu Debug, Select Windows then Threads
The following image shows :
Main Thread, this is the console application
ClassLibrary1.Class1.StartThread.AnonymousMethod_0, this is the thread started by the referenced assembly. If Ionic or a 3Rd party API started a thread, you may see something related to its namespace.