.Net 6.0 console application keeps displaying popup message while I am trying to code - reflection

I am typing in an example from the book, "C# 10 and .Net 6".
It is a console application with reflection.
Here is the code so far:
using System.Reflection;
Assembly? assembly = Assembly.GetEntryAssembly();
if (assembly == null) return;
// Loop through the assemlies that this app references
foreach (AssemblyName name in assembly.GetReferencedAssemblies())
{
// Load the assembly so we can read its details
Assembly a = Assembly.Load(name);
// declare a variable to count the number of methods
int methodCount = 0;
// loop through all the types in the assembly
foreach (TypeInfo t in a.DefinedTypes)
{
// add up the counts of methods
methodCount += t.GetMethods().Count();
}
//
}
I got this far and was about to type in the last part and I got the popup dialogue in the pic:
It says:
Specified argument was out of the range of valid values.
Parameter name: length
Why does this obtrusive popup keep displaying and stopping me from typing? What is it? What does it mean? Why does it not wait for you to try and build, compile or run before reporting the problem.
What is this and how do you make it go away?
I just want to add I was able to type it all in and the example runs correctly. But why does VS 2022 keep displaying this popup while I am trying to type?

This looks like a problem with Visual Studio or an extension. It's not a problem with your code.
You could try:
Restarting VS,
Restarting Windows,
Repairing/updating/reinstalling VS.

Related

Why does bpl has Error Loading a resource string after upgrade?

We have a bpl that has some resource (.rc) files which has strings in it. It is defined via STRINGTABLE and loaded via a LoadStr() call. The project was in version 10.1 Berlin. We upgraded to the latest 11.1 Alexandria and now the call returns NULL. So to test I added the line at the main
extern "C" int _libmain(unsigned long reason)
{
String str = LoadStr(231); **// Works**
return 1;
}
but the existing code below does not work.
**.h**
PACKAGE String __fastcall GetValueSetDesc(int ACount);
**.cpp**
String __fastcall GetValueSetDesc(int ACount)
{
String ValueDesc = LoadStr(ACount); **// Does not work, retuns NULL**
return ValueDesc;
}
I tried creating the project from scratch (and adding files to it). Any one has experienced this issue or know what to try?
The problem was with DevExpress components. The call was from a DevExpress change event. A call from a non DevExpress component worked fine. The way I solved this is to re-create the cbproj from scratch and add the files, settings etc (in the exe, the bpl seems fine). Man, DevExpress gave me a lot of grief this time around when we upgraded!

'BitmapStub' does not exist in the namespace 'Android.Graphics' Using Xamarin.Forms

I implemented a application for Sunmi T1 mini device in-build printer in Xamarin forms and i want to print a image with some text like billing receipt.
I integrated AIDL file for Sunmi T1 mini device you can see in image.
But i am facing namespacing issue in IWoyouService.cs "the type of namespace name 'BitmapStub' does not exist in the namespace 'Android.Graphics'."
case TransactionPrintBitmap: {
data.EnforceInterface (descriptor);
Android.Graphics.Bitmap arg0 = default (Android.Graphics.Bitmap);
arg0 = Android.Graphics.BitmapStub.AsInterface (data.ReadStrongBinder ());
ICallback arg1 = default (ICallback);
arg1 = ICallbackStub.AsInterface (data.ReadStrongBinder ());
this.PrintBitmap (arg0, arg1);
reply.WriteNoException ();
return true;
}
I attach my AIDL Zip file https://drive.google.com/file/d/1lrCgZwDrfyqs6LAwTP3pQ6nMzYIW4hrY/view?usp=sharing.
How can resolve this error in Xamarin.Forms
I had this exact same problem, and managed to solve it by adding another AIDL file to define what a 'Bitmap' is.
I copied this file from the Android Open Source Project and just added it into my project and set the build action to Android Interface Definition like the other Sunmi AIDL files.
Not sure why Xamarin doesn't manage to handle this automatically, but adding this solved the problem for me and I was able to build and successfully invoke the interface methods that accept bitmap parameters.
In case the link ever goes bad, here is the entire file you need to add - it's very small:
/* Save this in Bitmap.aidl and add to your project alongside the others */
package android.graphics;
parcelable Bitmap;

Cefsharp : problem with the Reqest Context of the General Usage page

I have some problems, to change user profile with cefsharp 71.0.2.
All is working good with an user1.
To change users, the General Usage Wiki page gives me the solution.
But the 3rd line of this code
var requestContextSettings = new RequestContextSettings { CachePath = cachePath2 };
browser = new ChromiumWebBrowser();
browser.RequestContext = new RequestContext(requestContextSettings, new CustomRequestContextHandler());
gives 2 errors :
impossible to convert Cefsharp.RequestContextSettings to Cefsharp.IRequestContext
CustomRequestContextHandler reference can't be found.
I used Nuget to include the package 71.0.2 targetFramework 461 to my project.
A RequestContext(requestContextSettings) constructor is working to run something, but the browser is frozen on the last page I loaded with the user1.
Some tips to fix the problem ?
I saw that a 73.1.120.pre is on GitHub, but I don't know how to manage that without some Nuget package.
Tx for your help.

Adding Linq-to-Sql class breaks simple ASP.NET web application

Using VS2012, latest SP/update applied.
I have been very frustrated trying to get an ObjectDataSource to work. See http://bit.ly/XTpdvN and http://bit.ly/XTpsHi.
I started a new Web Application project, compiling and running after each step, trying to make the steps as granular as possible.
1) Create new empty web application.
2) Add WebForm1.aspx.
3) Clean, rebuild, run (either View in Browser or in debugger).
4) Add new class to App_Code.
5) Repeat #3.
5) Add existing .mdf to App_Data.
6) Repeat #3.
7) Add Linq-to-Sql class to App_Code (Items.dbml). Leave it empty.
8) Clean, Rebuild, run in Debugger:
Compiler Error Message: CS0234: The type or namespace name 'Linq' does
not exist in the namespace 'System.Data' (are you missing an assembly
reference?)
Source Error:
Line 12: namespace ODS_Restart.App_Code Line 13: { Line 14: using
System.Data.Linq; Line 15: using System.Data.Linq.Mapping; Line 16:
using System.Data;
As far as I can tell, there is nothing in the code in App_Code that needs Linq:
namespace ODS_Restart.App_Code
{
public class BAL
{
public static List<string> GetCountries()
{
return new List<string>() { "USA", "Aus", "NZ"};
}
}
}
As I said, very frustrating. Any insight on how to get past this problem would be greatly apprectiated....
use one wizard for linq to sql program:
step 1. Take new project as windows form application .
step 2. Drag one button and DataGridView from toolbox on it.
step 2. Go to solution explorer. add database(.mdf) file to windows form application project which we've taken.
step 3. Same way by right clicking on windows form application project which we've taken add linq to sql class(.dbml) file.
step 4. Go to Server explorer add table in database taken in step 3. Add data to that table.
step 5. open that .dbml file from solution explorer and drag table created from server explorer on it.
step 6. Open form created in step 2. Double click on that button and add following code:
DataClasses1DataContext obj1 = new DataClasses1DataContext();
List<pp> obj2 = obj.pps.ToList();
dataGridView1.DataSource = obj1;
DataClasses1 is .dbml file added in step 3. pp is table name added in step 4. obj1 and obj2 are objects created. pps represents tablename(pp).

Websphere & Tivoli: NPE while trying to create PDAuthorizationContext

I am getting the following error when I try to start my Application...
[java.lang.IllegalStateException: java.lang.NullPointerException^M
at com.tivoli.pd.jutil.kb$1.run(kb$1.java:41)^M
at java.security.AccessController.doPrivileged(AccessController.java:229
)^M
at com.tivoli.pd.jutil.kb.c(kb.java:141)^M
at com.tivoli.pd.jutil.kb.(kb.java:56)^M
at com.tivoli.pd.jutil.PDContext.(PDContext.java:76)^M
at com.tivoli.pd.jazn.PDAuthorizationContext.(PDAuthorizationConte
xt.java:66)^M
I double checked the config file was accessible and I could read it. The code I am using looks as follows...
aC = new PDAuthorizationContext(cFile);
Is there a way to get more information on what is causing the NPE?
More information!!!
After debuging a bit, it appears the issue comes from this code (they use progaurd so it is a little hard to be 100% confident)...
Certificate[] arrayOfCertificate1 = ((KeyStore)???).getCertificateChain("DefaultID");
//Throws Null pointer (presumably because array is null)
Certificate localCertificate1 = arrayOfCertificate1[0];
EVEN MORE INFO
This appears to be some kind of dependency conflict (guess), because if I just create a sample App using PDAuthorizationContext it works fine.
Problem was related to the PD.jar version that I was using. Although I thought I was using one version I was using another. This was because on version was registered in my WebSphere library (under build path in eclipse). Once the proper library was introduced everything worked.

Resources