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

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);
}
}
}
}

Related

"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.

UWP: Can't load and show Interstitial video ad

I'm trying to monetize my app with Universal Windows. I followed the official tutorials but when I tried to load an interstitial ad, always I'm getting this errors:
Interstitial ad is not ready. With this error code: ClientConfiguration.
Failed to make http requestError. With this error code: NetworkConnectionFailure.
I don't know what I am missing.
This is my code:
public sealed partial class Myclass: Page {
InterstitialAd MyVideoAd;
public MyClass() {
this.InitializeComponent();
var MyAppId = "d25517cb-12d4-4699-8bdc-52040c712cab";
var MyAdUnitId = "11389925";
MyVideoAd = new InterstitialAd();
MyVideoAd.ErrorOccurred += MyVideoAd_ErrorOccurred;
MyVideoAd.RequestAd(AdType.Video, MyAppId, MyAdUnitId);
}
private void MyVideoAd_ErrorOccurred(object sender, AdErrorEventArgs e) {
String errrorMessage = e.ErrorMessage;
String errorCode = e.ErrorCode;
}
private void showInterstitial(object sender, TappedRoutedEventArgs e) {
MyVideoAd.Show();
}
}
When I execute the application, a few seconds after the MyVideoAd_ErrorOccurred method is launched with the values of errorMessage and errorCode as I've said. That happens on my Windows 10 mobile device and in the Desktop machine execution. The codes of adUnit and application id are the provided in the Microsoft page for tests.
I hope that you can help me.
For UWP app, please install Microsoft Universal Ad Client SDK and use AdMediatorControl.
References:
Install the Universal Ad Client SDK
Add and use the ad mediator control
Check my sample: https://github.com/Myfreedom614/UWP-Samples/tree/master/AdClientUWPApp
Be sure to have these 3 Capabilities defined inside your manifest:
<Capabilities>
...
<Capability Name="internetClient"/>
<Capability Name="internetClientServer"/>
<Capability Name="privateNetworkClientServer"/>
...
</Capabilities>
The video hasn't finished loading. you need to give it enough time for that. also you need to make sure it is loaded before calling it with.
if ((InterstitialAdState.Ready) == (MyVideoAd.State))
{
MyVideoAd.Show();
}

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.

MonoDevelop debugging error

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.