DataGridView throws odd errors - c#

Simply put i added a new form to my program to see the data directly instead of just manipulating though SQL. well when i add the data set. and it does work in the designer perfectly but when i go to build it it erros out
Severity Code Description Project File Line
Error CS0426 The type name 'Db12DataSet' does not exist in the type 'AllianceERP' AllianceERP C:\Users\dhelm.ALLMATINC.001\Documents\Visual Studio 2013\Projects\AllianceERP\AllianceERP\Form2.Designer.cs 230
the line it is referencing is private AllianceERP.Db12DataSet db12DataSet;
with redline under db12DataSet
and i think that the problem is that db12data set isnt in that location but is in another location ? My connection string is right and tested #
connection.ConnectionString = #"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=S:\Documents\2015\Db12.accdb";
Where have I gone wrong or is my thinking just off?

Related

Setting MauiSplashScreen tag on MyMauiProject.csproj with a mp4 file throw null exception from Resizetizer/SkiaSharpBitmapTools, looks hardcoded trash

Setting the MauiSplashScreen tag inside my net6.0 MyMauiProject.csproj pointing to a mp4 file makes it throw a null exception from Resizetizer/SkiaSharpBitmapTools. It looks like hardcoded trash from Microsoft. I don't even have a 'D:' drive on my machine, just 'C:', but the error points to D:\a\1\s\src\SingleProject\Resizetizer\src\SkiaSharpBitmapTools.cs:line 29 , a project I never created.
Was searching like a crazy on google, but there is nothing about it.
Even after it changes back to a gif and also changes to a svg, the error stays there.
Thinking about recreating the project and copying my source code to see if it fixes it, but I cant do it every time and that isn't a good solution.
I'm on a tight deadline project. I can't do in on Xamarin Forms because MS is discontinuing it and looks I can't do on MAUI too.
Severity Code Description Project File Line Suppression State
Error MAUI0000 System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.Maui.Resizetizer.SkiaSharpBitmapTools.GetOriginalSize() in D:\a\1\s\src\SingleProject\Resizetizer\src\SkiaSharpBitmapTools.cs:line 29
at Microsoft.Maui.Resizetizer.SkiaSharpTools.Resize(DpiPath dpi, String destination) in D:\a\1\s\src\SingleProject\Resizetizer\src\SkiaSharpTools.cs:line 47
at Microsoft.Maui.Resizetizer.Resizer.Resize(DpiPath dpi, String inputsFile) in D:\a\1\s\src\SingleProject\Resizetizer\src\Resizer.cs:line 101
at Microsoft.Maui.Resizetizer.ResizetizeImages.ProcessImageResize(ResizeImageInfo img, DpiPath[] dpis, ConcurrentBag`1 resizedImages) in D:\a\1\s\src\SingleProject\Resizetizer\src\ResizetizeImages.cs:line 172
at Microsoft.Maui.Resizetizer.ResizetizeImages.<>c__DisplayClass26_0.<ExecuteAsync>b__0(ResizeImageInfo img) in D:\a\1\s\src\SingleProject\Resizetizer\src\ResizetizeImages.cs:line 88
at Microsoft.Maui.Resizetizer.AsyncTaskExtensions.<>c__DisplayClass0_0`1.<ParallelForEach>b__0(TSource s) in D:\a\1\s\src\SingleProject\Resizetizer\src\AsyncTaskExtensions.cs:line 21 MyMauiProject C:\Users\MySelf\.nuget\packages\microsoft.maui.resizetizer.sdk\6.0.101-preview.11.2349\build\Microsoft.Maui.Resizetizer.Sdk.targets 463
When clicking on the error, the IDE points to:
<!-- Resize the images -->
<ResizetizeImages
PlatformType="$(ResizetizerPlatformType)"
IntermediateOutputPath="$(_MauiIntermediateImages)"
InputsFile="$(_ResizetizerInputsFile)"
Images="#(MauiImage->Distinct())">
</ResizetizeImages>
I never ever touched on this block.
Closing and opening Visual Studio/Project doesnt fix it either.
It looks like it's pointing to here.
I had exactly the same issue. The problem was that I had a non-image file (ie a file called list.txt) in the Resources/Images folder.
Removing the file fixed the issue and the code ran correctly.
Another person had a related error here, the solution was reinstall all environment.
I Think you realized the error isnt with your code but with: C:\Users\MySelf\.nuget\packages\microsoft.maui.resizetizer.sdk\6.0.101-preview.11.2349

Android/Xamarin/C#: Resource Id not constant anymore

I used to work on an Android/Xamarin project for Android 4.4, API Level 19 that contains an activity with the following code:
private void RadioButtonClick(object sender, EventArgs e)
{
RadioButton rb = (RadioButton)sender;
switch (rb.Id)
{
case Resource.Id.radioButton1:
...
The last time I looked at the project a couple of month ago, this used to work just fine. Now I want to continue working on the project for Android 8.0, API Level 26, but when I opened it in Visual Studio 2017 I got the compiler error (field)int ResourceId.RadioButton1 A constant value is expected.
Now this is not a problem in itself, as I can always use if (rb.Id == ...) instead of switch/case, but I would like to know why all of a sudden Resource.Id.radioButton1 is not recognized as a constant anymore, even though it is declared as such in Resource.Designer.cs:
public const int radioButton1 = 2131165244;
Has anyone else encountered something similar?
EDIT: Even stranger is that the project builds without complaint, but deployment is not possible due to the said error.
EDIT: It seems that the build process generates another Resource.Designer.cs file which is put into a folder obj\Debug\designtime. Once the file exists, the activities source code refers for the Id declarations to this new file and not to the original Resource.Designer.cs in the Resources folder.
However, all Ids in the new file are static and not const (which of course is the reason for the compiler error that prompted this question in the first place) and moreover they are all set to zero.
Are there any Android/Xamarin experts out there who can explain what is going on here? Might that even be a bug in Visual Studio 2017/Xamarin?
EDIT: Here is a link shedding some light on this topic: https://forums.xamarin.com/discussion/19369/compiling-resource-ids-static-vs-const
What I don't get is this: Why did the above code work at all considering that this problem is known since 2014?

OleDbCommand using wrong path

I have the following c# code in a WPF app:
var command = new OleDbCommand($"CREATE INDEX idx{index.ColumnName} ON {tableConfig.Name}({index.ColumnName})", _targetCon);
try
{
command.ExecuteNonQuery();
}
catch (Exception ex1) { _serilog.WriteError(METHOD_NAME, "Trouble adding index onto Access column", ex1); }
My problem is that when stepping through the code in the VS debugger, the line "command.ExecuteNonQuery();" is throwing an exception. At the time of the exception, the value of _targetCon.ConnectionString is "Provider=Microsoft.Jet.OleDb.4.0;Data Source=C:\AccessDatabases\APMS\unit3.mdb;" and the value of the _targetCon.DataSource is: C:\AccessDatabases\APMS\unit3.mdb This is the correct path. However, the value of ex2.Message is "Could not find file 'C:\Git_RB\AccessMigration\AccessLauncher\AccessLauncher.WPF\bin\Debug\Unit3.mdb'"
If I run the app outside of VS then I find that it's still trying to find the file in the database in the same folder as the exe:
Why is the command object ignoring the properties of its connection object and looking in the wrong path?
Check the actual value of the SQL statement that you are using. It might contain another table name than the one you expect, e.g. due to string truncation.

Creating new theme in orchard with codegeneration module

I was following the documentation on this OrchardProject.net link. I opened have activated the CodeGeneration module and opened the command prompt at the root of the project (Orchard.Web) and write "bin/Orchard.exe" for running the commands. Till then everything is fine. Now when I try to run the following command, it gives me the below exception. The command is:
codegen theme mishrajiTheme /BasedOn:TheThemeMachine /CreateProject:true /IncludeInSolution:true
Below is the output of the command.
Creating Theme
mishrajiTheme
Error executing command "codegen theme mishrajiTheme"
Specified argument was out of the range of valid values. Parameter
name: startIndex
Exception Details: System.ArgumentOutOfRangeException: Specified
argument was out of the range of valid values. Parameter name:
startIndex
Stack Trace:
[ArgumentOutOfRangeException: Specified argument was out of the range
of valid values. Parameter name: startIndex] at
System.String.Insert(Int32 startIndex, String value) at
Orchard.CodeGeneration.Commands.CodeGenerationCommands.AddToSolution(TextWriter
output, String projectName, String projectGuid, String
containingFolder, String solutionFolderGuid) at
Orchard.CodeGeneration.Commands.CodeGenerationCommands.CreateThemeFromTemplates(TextWriter
output, String themeName, String baseTheme, String projectGuid,
Boolean includeInSolution) at
Orchard.CodeGeneration.Commands.CodeGenerationCommands.IntegrateTheme(String
themeName, String baseTheme) at
Orchard.CodeGeneration.Commands.CodeGenerationCommands.CreateTheme(String
themeName)
What I am doing wrong here or It is a bug in Orchard code generation module.
Please guide. I am using Orchard 1.10 version.
I solved this problem by changing the CodeGenerationCommands Class in line 434 in Orchard 1.10. the line is :
solutionText = solutionText.Insert(solutionText.LastIndexOf("EndProject\r\n"), projectReference);
to this :
solutionText = solutionText.Insert(solutionText.LastIndexOf("EndProject\n"), projectReference);
i don't know why by \r\n can not found the final EndProject and by changing that to \n it works fine
The line of code in question that has failed is this:
solutionText = solutionText.Insert(solutionText
.LastIndexOf("EndProject\r\n"),projectReference)
.Replace("GlobalSection(ProjectConfigurationPlatforms) = postSolution\r\n",
projectConfiguationPlatforms);
If solutionText.LastIndexOf("EndProject\r\n") doesn't find anything it will return -1 - see the MSDN docs here.
It looks like that is then being passed to the string.Insert which is an invalid out of index.
The only thing that I can think is that your git client or however you got your hands on the orchard source has somehow changed the line endings in the file so it can't find the \r\n.
I'm guessing you are from the indian subcontinent, is your OS running a non-english language? I don't think that the .sln file localises fields like EndProject and I don't think Windows varies its newline character representation but something is going wrong here.
Workaround Solution
This is the very last thing that the codegen theme command does, it has created everything else and just failed to add your project into the Orchard.sln. To get moving right now you can just add it to your solution:
In visual studio, open solution explorer window
Right click on your Themes solution folder
Click Add | Existing project
Navigate to the folder and select your new theme
Potential Bug
It seems like there could be a bug here. Would you be willing to post your .sln file to me via email so I can investigate it further?

0x3 error using pdbstr (Source indexing)

I am trying to use the PDBSTR.EXE tool to merge version information into a PDB file and from time to time I encounter the following error:
[result: error 0x3 opening K:\dev\main\bin\mypdbfile.pdb] <- can be a different PDB file.
An example of the command line that I use is:
pdbstr.exe -w -s:srcsrv -p:K:\dev\main\bin\mypdbfile.pdb -i:C:\Users\username\AppData\Local\Temp\tmp517B.stream
Could you tell me what would cause error code 0x3?
If the error code is similar to the standard System error code 3 ERROR_PATH_NOT_FOUND, then it seems to think that the path K:\dev\main\bin\mypdbfile.pdb does NOT exist when in fact it DOES.
However please note that my K: drive is a SUBST'ed drive.
(System error code reference https://msdn.microsoft.com/en-ca/library/windows/desktop/ms681382(v=vs.85).aspx)
Do you know what the 0x3 error code could possibly mean?
If this error code appears from time to time, then i guess the ERROR_PATH_NOT_FOUND might be the real problem.
I guess the cause is, i couldn't see any double quotes wrapping the path you've given as input. When the path contains a folder name with spaces in it, it breaks your path. For ex
pdbstr.exe -w -s:srcsrv -p:K:\dev\main\my folder with spaces\mypdbfile.pdb -i:C:\Users\username\AppData\Local\Temp\tmp517B.stream
Add a double quote around the path and that might solve it. Hope it helps.

Categories

Resources