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.
Related
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
I'm working on a simple File Explorer exe which leads to this error and I tried a few methods and couldn't solve it.
MyCode:
private void GetDirectories(DirectoryInfo[] subDirs, TreeNode nodeToAddTo)
{
TreeNode aNode;
DirectoryInfo[] subSubDirs;
foreach (DirectoryInfo subDir in subDirs)
{
aNode = new TreeNode(subDir.Name, 0, 0);
aNode.Tag = subDir;
aNode.ImageKey = "folder";
subSubDirs = subDir.GetDirectories();
if (subSubDirs.Length != 0)
{
GetDirectories(subSubDirs, aNode);
}
nodeToAddTo.Nodes.Add(aNode);
}
}
But then I get this error:
System.IO.DirectoryNotFoundException HResult=0x80070003
Message=Could not find a part of the path
'C:\Users\zero_000\Documents\DAZ 3D\Studio\My Library\data\DAZ3D - G3
Superhero Pack\24205 - Super Bodysuit Casual Style
Textures\IM00024205-01_SuperBodysuitCasualStyleTextures\Content\People\Genesis
3 Male\Clothing\Super Bodysuit\Materials\Casual Style\3Delight'.
Source=mscorlib
I have tried shorten the file path using:
[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
public static extern int GetShortPathName(
[MarshalAs(UnmanagedType.LPTStr)]
string path,
[MarshalAs(UnmanagedType.LPTStr)]
StringBuilder shortPath,
int shortPathLength
);
But this just leads to another problem which is essentially the same.
Anyway to resolve this?
[Update 1]
The program is supposed to look into every files and folders i have, and sometimes the names are long and they aren't created by me, but by the installer or some other user's zip file naming.
Here's some screenshot as requested.
Screenshot: The error coming from my IDE
Screenshot: The folder that exist when i open from my Explorer
Screenshot: The path that seems to be not found when I access from CMD
I'm running on:
Win 10 Pro (64 bit)
VS2017
.NET Framework 4.7.1
My App.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.1"/>
</startup>
<runtime>
<AppContextSwitchOverrides value="Switch.System.IO.UseLegacyPathHandling=false;Switch.System.IO.BlockLongPaths=false" />
</runtime>
</configuration>
[Update 2]
Okay,some of you might not get what I'm trying to show here.
Basically here's the problem, the C# Desktop App i'm coding throws me an error suspect due to long file path.
But here's what's funny.
In my c# code, the nested function to .GetDirectories() keeps going deeper and deeper into the subfolders. Hence it produced a long file path. But it throws and error shown above.
VS.NET 2017: "C:\Users\zero_000\Documents\DAZ 3D\Studio\My
Library\data\DAZ3D - G3 Superhero Pack\24205 - Super Bodysuit Casual
Style
Textures\IM00024205-01_SuperBodysuitCasualStyleTextures\Content\People\Genesis
3 Male\Clothing\Super Bodysuit\Materials\Casual Style\3Delight"
But when I paste this path into Windows's Explorer in Win10Pro, it automatically changes the path into shorter version. Which works and it shows the folder and it's content.
Win10 Explorer:
"C:\Users\zero_000\Documents\DAZ3D~1\Studio\MYLIBR~1\data\DAZ3D-~1\24205-~1\IM0002~1\Content\People\GENESI~1\Clothing\SUPERB~1\MATERI~1\CASUAL~1\3Delight"
Then I pasted the same path into CMD and it shows error as well by saying the path doesn't exist (As shown in the screenshot above).
[Update 3]
I thought I should check again on the most simplest method to see if it was really it by doing:
DirectoryInfo da = new DirectoryInfo(#"C:\Users\zero_000\Documents\DAZ3D~1\Studio\MYLIBR~1\data\DAZ3D-~1\24205-~1\IM0002~1\Content\People\GENESI~1\Clothing\SUPERB~1\MATERI~1\CASUAL~1\3Delight");
Console.WriteLine(#"C:\Users\zero_000\Documents\DAZ3D~1\Studio\MYLIBR~1\data\DAZ3D-~1\24205-~1\IM0002~1\Content\People\GENESI~1\Clothing\SUPERB~1\MATERI~1\CASUAL~1\3Delight");
DirectoryInfo db = new DirectoryInfo(#"C:\Users\zero_000\Documents\DAZ 3D\Studio\My Library\data\DAZ3D - G3 Superhero Pack\24205 - Super Bodysuit Casual Style Textures\IM00024205-01_SuperBodysuitCasualStyleTextures\Content\People\Genesis 3 Male\Clothing\Super Bodysuit\Materials\Casual Style\3Delight");
Console.WriteLine(#"C:\Users\zero_000\Documents\DAZ 3D\Studio\My Library\data\DAZ3D - G3 Superhero Pack\24205 - Super Bodysuit Casual Style Textures\IM00024205-01_SuperBodysuitCasualStyleTextures\Content\People\Genesis 3 Male\Clothing\Super Bodysuit\Materials\Casual Style\3Delight");
It doesn't seems to be generating any errors in this case.
[Update 4]
Apparently, if i do da.GetDirectories(); it will throw error instantly because any directories collected from that path will be added into the DirectoryInfo resulted super long path.
Is there anyway to resolve this even if it's long file path?
Ok. After I've tested out a bit.
I noticed there are no straight answer to this because the whole issue is due to long file path.
I tested the path "C:\Users\zero_000\Documents\DAZ3D~1\Studio\MYLIBR~1\data\DAZ3D-~1\24205-~1\IM0002~1\Content\People\GENESI~1\Clothing\SUPERB~1\MATERI~1\CASUAL~1\3Delight" which is the shorter version generated by File Explorer.
If I navigate to this folder, it works.
But if I tries to create a folder inside this folder, it will just throw an error to me somewhat similar to the errors shown in my C# App.
Which means, given by the default behavior of my staff or any users, they wouldn't even be able to reach this stage. (unless like me, this folder was extracted via 7zip).
My option is to just throw a warning message box to force user not to have long file path.
You can make those AppContext switch settings machine-wide by putting the change in the Windows registry. This way, you don't have to manually add the overrides to all of your App.config files.
This could be especially relevant if you need to set a switch to 'true' in .NET Framework 4.7, because it has a known issue where switch values are unilaterally reported as 'false' under certain poorly explained circumstances:
CauseWhen the program reads the value of an AppContext switch in the registry, the data cannot be retrieved. In this case, it is assumed that something is wrong with the way the setting is specified in the registry, and a value of False is returned to the application.https://support.microsoft.com/en-us/help/4036977
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?
Question Background:
I have a WebApi controller who's logic code relies on reading data contained in a number of XML files. These XML files have been included in the App_Data folder of the WebApi project.
The Issue:
I'm trying to use the relative path of the XML files in the following way:
[System.Web.Http.HttpGet]
public string CallerOne()
{
string docOne = #"~\AppData\DocOne.xml";
string poll = #"~\AppData\Poll.xml";
var response = _Caller.CallService(docOne, poll);
return ConvertXmlToJson(response);
}
When running the WebApi code and calling the Url to the CallerOne method I receive the following error:
An exception of type 'System.IO.DirectoryNotFoundException'
occurred in System.Xml.dll but was not handled in user code
Additional information: Could not find a part of the path
'C:\Program Files (x86)\IIS Express\~\AppData\FPS.xml'.
I also want to eventually publish this to Azure and include these files.
How can I use the relative path to read in the XML files in the App_Data folder?
Ended up finding the answer.
The following is needed to read the relative paths in a WebApi project:
var fullPath = System.Web.Hosting.HostingEnvironment.MapPath(#"~/App_Data/yourXmlFile.xml");
As jdweng inferred several months back, Environment.GetEnvironmentVariable("AppData") would seem to be the preferred method. The OP's auto-accepted answer and that give quite different results. For example, using both of those in my project, I get:
C:\\Projects\\PlatypusReports\\PlatypusReports\\App_Data\\yourXmlFile.xml
...for the OP's long-winded code, namely this:
var fullPath = System.Web.Hosting.HostingEnvironment.MapPath(#"~/App_Data/yourXmlFile.xml");
...and this:
C:\\Users\\cshannon\\AppData\\Roaming
...for jdweng's code, to wit:
string appData = Environment.GetEnvironmentVariable("AppData");
OTOH, this code:
string appDataFolder = HttpContext.Current.Server.MapPath("~/App_Data/");
returns:
C:\\Projects\\PlatypusReports\\PlatypusReports\App_Data\
So it's very similar in results (if not methodology) to the first example above. I actually got it from a question I asked almost two years ago, which I had forgotten about.
I'm not positive if jdweng's approach would work as expected once the app is deployed on a server, but I have much more confidence in it than the other approaches.
Can anyone verify?
UPDATE
The accepted answer here has 237 upvotes at time of typing, so seems pretty reliable, albeit 6 years old (42 in dog years, which may be a good sign).
Your approach is fine. You just had some tpying error,
You wrote
string docOne = #"~\AppData\DocOne.xml";
But it should have been
string docOne = #"~\App_Data\DocOne.xml";
We're pretty new to Ruby and very new to IronRuby so please bear with me. We're in C# trying to do something very simple. I've got a ruby script called doExtract.rb and I need to pass it a file called myfile.txt. We've copied all the files required into the /bin folder of the build and they run correctly when called via the command line.
var rubyRuntime = Ruby.CreateRuntime();
var rubyEngine = rubyRuntime.GetEngine("rb");
String fullPath = String.Format("{0} {1}", "doExtract.rb", "myfile.txt");
rubyEngine.ExecuteFile(fullPath);
gives me an error of "Illegal characters in path"
I've searched high & low on the t'interwebs and to no avail.
We've tried adding the search paths to the rubyEngine and using a full path to the myfile.txt but still get the error. If we call a simple ruby script with no parameters then it works fine. We've also tried with escaped slashed both backwards and forwards in the myfile.txt. I'm sure it'd something really stupid that we're not doing !
Any suggestions where we're going wrong ?
Thanks