Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

You can only use this provider with an absolute path for the excel file?? #76

Closed
halcwb opened this issue Oct 15, 2020 · 2 comments
Closed

Comments

@halcwb
Copy link

halcwb commented Oct 15, 2020

Description

When the path of the Excel file is relative. This will not work when moving the compiled code to a different location. The path will still be the absolute path of the original coding location.

Repro steps

Please provide the steps required to reproduce the problem

  1. Create a type with the type provider on a D disk

  2. Try to run the compiled code on a C disk

Expected behavior

If the path for the type is the same relative to the working directory, it should be found.

Actual behavior

The error you can observe is:

System.TypeInitializationException: The type initializer for 'MyTypeProvider' threw an exception.
---> System.TypeInitializationException: The type initializer for '<StartupCode$BlahBlah>.$Blah' threw an exception.
---> System.Exception: Could not open file 'D:\Development\MyExcel.xlsx'. DirectoryNotFoundException

The path that will be shown in the error message is the exact absolute path that was used when compiling the code.

Known workarounds

Using SOURCE_DIRECTORY to create an absolute path gives the same result.

Effectively, this typeprovider can only moved to a location with the same exact absolute path! Meaning I would have to reconfigure a production machine with a D disk just to run this code??

Related information

N/A

@halcwb
Copy link
Author

halcwb commented Oct 15, 2020

Stumbled upon this issue: #36.

Problem solved, pfff.

@halcwb halcwb closed this as completed Oct 15, 2020
@quintusm
Copy link
Collaborator

@halcwb Glad you found a solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants